You are here

public function SearchLocalTask::getDerivativeDefinitions in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/search/src/Plugin/Derivative/SearchLocalTask.php \Drupal\search\Plugin\Derivative\SearchLocalTask::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

core/modules/search/src/Plugin/Derivative/SearchLocalTask.php, line 49
Contains \Drupal\search\Plugin\Derivative\SearchLocalTask.

Class

SearchLocalTask
Provides local tasks for each search page.

Namespace

Drupal\search\Plugin\Derivative

Code

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