You are here

public function StickynavController::listThemes in Sticky Navigation 8

Lists links to configuration for stickynav per theme.

Return value

string Table of all enabled themes where you can set the stickynav settings.

1 string reference to 'StickynavController::listThemes'
stickynav.routing.yml in ./stickynav.routing.yml
stickynav.routing.yml

File

src/Controller/StickynavController.php, line 41

Class

StickynavController
Returns responses for stickynav module routes.

Namespace

Drupal\stickynav\Controller

Code

public function listThemes() {
  $build = [];
  $themes = $this->theme_handler
    ->listInfo();
  $rows = [];
  foreach ($themes as $name => $theme) {
    $row = [
      $theme->info['name'],
    ];
    $links['edit'] = [
      'title' => $this
        ->t('Edit'),
      'url' => Url::fromRoute('stickynav.set_theme', [
        'theme' => $name,
      ]),
    ];
    $row[] = [
      'data' => [
        '#type' => 'operations',
        '#links' => $links,
      ],
    ];
    $rows[] = $row;
  }
  $header = array(
    $this
      ->t('Theme'),
    $this
      ->t('Action'),
  );
  $build['stickynav_themes'] = array(
    '#theme' => 'table',
    '#rows' => $rows,
    '#header' => $header,
  );
  return $build;
}