You are here

protected function PageParametersForm::renderRows in Page Manager 8

Same name and namespace in other branches
  1. 8.4 page_manager_ui/src/Form/PageParametersForm.php \Drupal\page_manager_ui\Form\PageParametersForm::renderRows()
1 call to PageParametersForm::renderRows()
PageParametersForm::buildForm in page_manager_ui/src/Form/PageParametersForm.php
Form constructor.

File

page_manager_ui/src/Form/PageParametersForm.php, line 59
Contains \Drupal\page_manager_ui\Form\PageParametersForm.

Class

PageParametersForm

Namespace

Drupal\page_manager_ui\Form

Code

protected function renderRows($cached_values) {
  $rows = [];

  /** @var $page \Drupal\page_manager\Entity\Page */
  $page = $cached_values['page'];

  /**
   * @var string $parameter
   */
  foreach ($page
    ->getParameterNames() as $parameter_name) {
    $parameter = $page
      ->getParameter($parameter_name);
    $row = [];
    $row['machine_name'] = $parameter['machine_name'];
    if ($label = $parameter['label']) {
      $row['label'] = $label;
    }
    else {
      $row['type']['colspan'] = 2;
    }
    $row['type']['data'] = $parameter['type'] ?: $this
      ->t('<em>No context assigned</em>');
    list($route_partial, $route_parameters) = $this
      ->getOperationsRouteInfo($cached_values, $cached_values['id'], $parameter_name);
    $build = [
      '#type' => 'operations',
      '#links' => $this
        ->getOperations($route_partial, $route_parameters),
    ];
    $row['operations']['data'] = $build;
    $rows[$parameter_name] = $row;
  }
  return $rows;
}