class DynamicLocalTasks in Thunder 8.2
Same name and namespace in other branches
- 8.5 modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks
 - 8.3 modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks
 - 8.4 modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks
 - 6.2.x modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks
 - 6.0.x modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks
 - 6.1.x modules/thunder_article/src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks
 
Generates content view local tasks.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\thunder_article\Plugin\Derivative\DynamicLocalTasks implements ContainerDeriverInterface uses StringTranslationTrait
 
 
Expanded class hierarchy of DynamicLocalTasks
1 string reference to 'DynamicLocalTasks'
- thunder_article.links.task.yml in modules/
thunder_article/ thunder_article.links.task.yml  - modules/thunder_article/thunder_article.links.task.yml
 
File
- modules/
thunder_article/ src/ Plugin/ Derivative/ DynamicLocalTasks.php, line 17  
Namespace
Drupal\thunder_article\Plugin\DerivativeView source
class DynamicLocalTasks extends DeriverBase implements ContainerDeriverInterface {
  use StringTranslationTrait;
  /**
   * The module handler service.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  protected $moduleHandler;
  /**
   * The route provider service.
   *
   * @var \Drupal\Core\Routing\RouteProviderInterface
   */
  protected $routeProvider;
  /**
   * The config factory service.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;
  /**
   * Creates an DynamicLocalTasks object.
   *
   * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
   *   The translation manager.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler service.
   * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
   *   The route provider service.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory service.
   */
  public function __construct(TranslationInterface $string_translation, ModuleHandlerInterface $module_handler, RouteProviderInterface $route_provider, ConfigFactoryInterface $config_factory) {
    $this->stringTranslation = $string_translation;
    $this->moduleHandler = $module_handler;
    $this->routeProvider = $route_provider;
    $this->configFactory = $config_factory;
  }
  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    return new static($container
      ->get('string_translation'), $container
      ->get('module_handler'), $container
      ->get('router.route_provider'), $container
      ->get('config.factory'));
  }
  /**
   * {@inheritdoc}
   */
  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;
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            DeriverBase:: | 
                  protected | property | List of derivative definitions. | 1 | 
| 
            DeriverBase:: | 
                  public | function | 
            Gets the definition of a derivative plugin. Overrides DeriverInterface:: | 
                  |
| 
            DynamicLocalTasks:: | 
                  protected | property | The config factory service. | |
| 
            DynamicLocalTasks:: | 
                  protected | property | The module handler service. | |
| 
            DynamicLocalTasks:: | 
                  protected | property | The route provider service. | |
| 
            DynamicLocalTasks:: | 
                  public static | function | 
            Creates a new class instance. Overrides ContainerDeriverInterface:: | 
                  |
| 
            DynamicLocalTasks:: | 
                  public | function | 
            Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: | 
                  |
| 
            DynamicLocalTasks:: | 
                  public | function | Creates an DynamicLocalTasks object. | |
| 
            StringTranslationTrait:: | 
                  protected | property | The string translation service. | 1 | 
| 
            StringTranslationTrait:: | 
                  protected | function | Formats a string containing a count of items. | |
| 
            StringTranslationTrait:: | 
                  protected | function | Returns the number of plurals supported by a given language. | |
| 
            StringTranslationTrait:: | 
                  protected | function | Gets the string translation service. | |
| 
            StringTranslationTrait:: | 
                  public | function | Sets the string translation service to use. | 2 | 
| 
            StringTranslationTrait:: | 
                  protected | function | Translates a string to the current language or to a given language. |