function ContainerInfoController::parameterList

Same name in other branches
  1. 5.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 179

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,
                'filter' => TRUE,
            ];
            $row['operations']['data'] = [
                '#type' => 'operations',
                '#links' => [
                    'devel' => [
                        'title' => $this->t('Devel'),
                        'url' => Url::fromRoute('devel.container_info.parameter.detail', [
                            'parameter_name' => $parameter_name,
                        ]),
                        'attributes' => [
                            'class' => [
                                'use-ajax',
                            ],
                            'data-dialog-type' => 'modal',
                            'data-dialog-options' => Json::encode([
                                'width' => 700,
                                'minHeight' => 500,
                            ]),
                        ],
                    ],
                ],
            ];
            $rows[$parameter_name] = $row;
        }
        ksort($rows);
    }
    $output['parameters'] = [
        '#type' => 'devel_table_filter',
        '#filter_label' => $this->t('Search'),
        '#filter_placeholder' => $this->t('Enter parameter name'),
        '#filter_description' => $this->t('Enter a part of the parameter name to filter by.'),
        '#header' => $headers,
        '#rows' => $rows,
        '#empty' => $this->t('No parameters found.'),
        '#sticky' => TRUE,
        '#attributes' => [
            'class' => [
                'devel-parameter-list',
            ],
        ],
    ];
    return $output;
}