Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SearchLocalTask.php

function SearchLocalTask::getDerivativeDefinitions

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/search/src/Plugin/Derivative/SearchLocalTask.php, line 44

Class

SearchLocalTask
Provides local tasks for each search page.

Namespace

Drupal\search\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    $this->derivatives = [];
    if ($this->searchPageRepository
        ->getDefaultSearchPage()) {
        $active_search_pages = $this->searchPageRepository
            ->getActiveSearchPages();
        foreach ($this->searchPageRepository
            ->sortSearchPages($active_search_pages) as $entity_id => $entity) {
            $this->derivatives[$entity_id] = [
                'title' => $entity->label(),
                'route_name' => 'search.view_' . $entity_id,
                'base_route' => 'search.view',
                'weight' => $entity->getWeight(),
            ];
        }
    }
    return $this->derivatives;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal