/** * Helper function for self::listing() to build table rows. * * @param array[] $hierarchy * Keys are plugin IDs, and values are arrays of the same structure as this * parameter. The depth is unlimited. * @param integer $depth * The depth of $hierarchy's top-level items as seen from the original * hierarchy's root (this function is recursive), starting with 0. * * @return array * A render array. */ protected function buildListingLevel(array $hierarchy, $depth) { $rows = []; foreach ($hierarchy as $plugin_id => $children) { $definition = $this->paymentStatusManager->getDefinition($plugin_id); $operations_provider = $this->paymentStatusManager->getOperationsProvider($plugin_id); $indentation = ['#theme' => 'indentation', '#size' => $depth]; $rows[$plugin_id] = ['label' => ['#markup' => $this->renderer->render($indentation) . $definition['label']], 'description' => ['#markup' => $definition['description']], 'operations' => ['#type' => 'operations', '#links' => $operations_provider ? $operations_provider->getOperations($plugin_id) : []]]; $rows = array_merge($rows, $this->buildListingLevel($children, $depth + 1)); } return $rows; }
/** * {@inheritdoc} */ public function render(ResultRow $values) { $plugin_id = $this->getValue($values); $plugin_definition = $this->paymentStatusManager->getDefinition($plugin_id); return $plugin_definition['label']; }