You are here

public function ContainerInfoController::parameterList in Devel 8

Same name and namespace in other branches
  1. 8.3 src/Controller/ContainerInfoController.php \Drupal\devel\Controller\ContainerInfoController::parameterList()
  2. 8.2 src/Controller/ContainerInfoController.php \Drupal\devel\Controller\ContainerInfoController::parameterList()
  3. 4.x src/Controller/ContainerInfoController.php \Drupal\devel\Controller\ContainerInfoController::parameterList()

Builds the parameters overview page.

Return value

array A render array as expected by the renderer.

1 string reference to 'ContainerInfoController::parameterList'
devel.routing.yml in ./devel.routing.yml
devel.routing.yml

File

src/Controller/ContainerInfoController.php, line 187

Class

ContainerInfoController
Provides route responses for the container info pages.

Namespace

Drupal\devel\Controller

Code

public function parameterList() {
  $headers = [
    $this
      ->t('Name'),
    $this
      ->t('Operations'),
  ];
  $rows = [];
  if ($container = $this->kernel
    ->getCachedContainerDefinition()) {
    foreach ($container['parameters'] as $parameter_name => $definition) {
      $row['name'] = [
        'data' => $parameter_name,
        'class' => 'table-filter-text-source',
      ];
      $row['operations']['data'] = [
        '#type' => 'operations',
        '#links' => [
          'devel' => [
            'title' => $this
              ->t('Devel'),
            'url' => Url::fromRoute('devel.container_info.parameter.detail', [
              'parameter_name' => $parameter_name,
            ]),
          ],
        ],
      ];
      $rows[$parameter_name] = $row;
    }
    ksort($rows);
  }
  $output['#attached']['library'][] = 'system/drupal.system.modules';
  $output['filters'] = [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'table-filter',
        'js-show',
      ],
    ],
  ];
  $output['filters']['text'] = [
    '#type' => 'search',
    '#title' => $this
      ->t('Search'),
    '#size' => 30,
    '#placeholder' => $this
      ->t('Enter parameter name'),
    '#attributes' => [
      'class' => [
        'table-filter-text',
      ],
      'data-table' => '.devel-filter-text',
      'autocomplete' => 'off',
      'title' => $this
        ->t('Enter a part of the parameter name to filter by.'),
    ],
  ];
  $output['parameters'] = [
    '#type' => 'table',
    '#header' => $headers,
    '#rows' => $rows,
    '#empty' => $this
      ->t('No parameters found.'),
    '#sticky' => TRUE,
    '#attributes' => [
      'class' => [
        'devel-parameter-list',
        'devel-filter-text',
      ],
    ],
  ];
  return $output;
}