public function LayoutController::layoutPageList

Presents a list of layouts.

Return value

array A form array as expected by drupal_render().

1 string reference to 'LayoutController::layoutPageList'
layout.routing.yml in drupal/core/modules/layout/layout.routing.yml
drupal/core/modules/layout/layout.routing.yml

File

drupal/core/modules/layout/lib/Drupal/layout/Controller/LayoutController.php, line 48
Contains \Drupal\layout\Controller\LayoutController.

Class

LayoutController
Controller routines for layout routes.

Namespace

Drupal\layout\Controller

Code

public function layoutPageList() {

  // Get list of layouts defined by enabled modules and themes.
  $layouts = $this->layoutManager
    ->getDefinitions();
  $rows = array();
  $header = array(
    t('Name'),
    t('Source'),
  );
  foreach ($layouts as $name => $layout) {
    $provider_info = system_get_info($layout['provider']['type'], $layout['provider']['provider']);

    // Build table columns for this row.
    $row = array();
    $row['name'] = l($layout['title'], 'admin/structure/templates/manage/' . $name);

    // Type can either be 'module' or 'theme'.
    $row['provider'] = t('@name @type', array(
      '@name' => $provider_info['name'],
      '@type' => t($layout['provider']['type']),
    ));
    $rows[] = $row;
  }
  $build = array();
  $build['table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  );
  return $build;

  // Ensure the provider types are translatable. These do not need to run,
  // just inform the static code parser of these source strings.
  t('module');
  t('theme');
}