class AutoEntityLabelConfigTask in Automatic Entity Label 8
Same name and namespace in other branches
- 8.3 src/Plugin/Derivative/AutoEntityLabelConfigTask.php \Drupal\auto_entitylabel\Plugin\Derivative\AutoEntityLabelConfigTask
- 8.2 src/Plugin/Derivative/AutoEntityLabelConfigTask.php \Drupal\auto_entitylabel\Plugin\Derivative\AutoEntityLabelConfigTask
AutoEntityLabelConfigTask class.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface- class \Drupal\auto_entitylabel\Plugin\Derivative\AutoEntityLabelConfigTask implements ContainerDeriverInterface
 
Expanded class hierarchy of AutoEntityLabelConfigTask
1 string reference to 'AutoEntityLabelConfigTask'
File
- src/Plugin/ Derivative/ AutoEntityLabelConfigTask.php, line 13 
Namespace
Drupal\auto_entitylabel\Plugin\DerivativeView source
class AutoEntityLabelConfigTask extends DeriverBase implements ContainerDeriverInterface {
  /**
   * The entity manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityManager;
  /**
   * Creates an FieldUiLocalTask object.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager
   *   The entity manager.
   */
  public function __construct(EntityTypeManagerInterface $entity_manager) {
    $this->entityManager = $entity_manager;
  }
  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    return new static($container
      ->get('entity.manager'));
  }
  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $this->derivatives = [];
    foreach ($this->entityManager
      ->getDefinitions() as $entity_type_id => $entity_type) {
      // Special handling of Taxonomy. See https://www.drupal.org/node/2822546
      if ($entity_type_id == "taxonomy_vocabulary") {
        $base_route = "entity.{$entity_type_id}.overview_form";
      }
      else {
        $base_route = "entity.{$entity_type_id}.edit_form";
      }
      if ($entity_type
        ->hasLinkTemplate('auto-label')) {
        $this->derivatives["{$entity_type_id}.auto_label_tab"] = [
          'route_name' => "entity.{$entity_type_id}.auto_label",
          'title' => 'Automatic label',
          'base_route' => $base_route,
          'weight' => 100,
        ];
      }
    }
    foreach ($this->derivatives as &$entry) {
      $entry += $base_plugin_definition;
    }
    return $this->derivatives;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| AutoEntityLabelConfigTask:: | protected | property | The entity manager. | |
| AutoEntityLabelConfigTask:: | public static | function | Creates a new class instance. Overrides ContainerDeriverInterface:: | |
| AutoEntityLabelConfigTask:: | public | function | Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: | |
| AutoEntityLabelConfigTask:: | public | function | Creates an FieldUiLocalTask object. | |
| DeriverBase:: | protected | property | List of derivative definitions. | 1 | 
| DeriverBase:: | public | function | Gets the definition of a derivative plugin. Overrides DeriverInterface:: | 
