You are here

public function DynamicLocalTasks::getDerivativeDefinitions in Thunder 8.4

Same name and namespace in other branches
  1. 8.5 modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  2. 8.2 modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  3. 8.3 modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  4. 6.2.x modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  5. 6.0.x modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
  6. 6.1.x modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks::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

modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php, line 76

Class

DynamicLocalTasks
Generates content view local tasks.

Namespace

Drupal\thunder_article\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  if ($this->moduleHandler
    ->moduleExists('content_lock') && $this->routeProvider
    ->getRoutesByNames([
    'view.locked_content.page_1',
  ])) {
    $this->derivatives["thunder_article.content_lock"] = [
      'route_name' => "view.locked_content.page_1",
      'title' => $this
        ->t('Locked content'),
      'parent_id' => "system.admin_content",
      'weight' => 2,
    ] + $base_plugin_definition;
  }
  if ($this->moduleHandler
    ->moduleExists('scheduler') && $this->routeProvider
    ->getRoutesByNames([
    'view.scheduler_scheduled_content.overview',
  ])) {

    // See thunder_article_menu_local_tasks_alter() for how this is displayed
    // or not depending on configuration.
    $this->derivatives["thunder_article.scheduler"] = [
      'route_name' => "view.scheduler_scheduled_content.overview",
      'title' => $this
        ->t('Scheduled content'),
      'parent_id' => "system.admin_content",
      'weight' => 3,
      'cache_tags' => $this->configFactory
        ->get('thunder_article.settings')
        ->getCacheTags(),
    ] + $base_plugin_definition;
  }
  if ($this->moduleHandler
    ->moduleExists('access_unpublished') && $this->routeProvider
    ->getRoutesByNames([
    'access_unpublished.access_token.list',
  ])) {
    $this->derivatives["thunder_article.access_unpublished"] = [
      'route_name' => "access_unpublished.access_token.list",
      'title' => $this
        ->t('Unpublished access'),
      'parent_id' => "system.admin_content",
      'weight' => 4,
    ] + $base_plugin_definition;
  }
  return $this->derivatives;
}