class WSFieldLocalAction in Web Service Data 8
Same name and namespace in other branches
- 2.0.x modules/wsdata_field/src/Plugin/Derivative/WSFieldLocalAction.php \Drupal\wsdata_field\Plugin\Derivative\WSFieldLocalAction
Provides local action definitions for all entity bundles.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface- class \Drupal\wsdata_field\Plugin\Derivative\WSFieldLocalAction implements ContainerDeriverInterface uses StringTranslationTrait
 
Expanded class hierarchy of WSFieldLocalAction
1 string reference to 'WSFieldLocalAction'
- wsdata_field.links.action.yml in modules/wsdata_field/ wsdata_field.links.action.yml 
- modules/wsdata_field/wsdata_field.links.action.yml
File
- modules/wsdata_field/ src/ Plugin/ Derivative/ WSFieldLocalAction.php, line 15 
Namespace
Drupal\wsdata_field\Plugin\DerivativeView source
class WSFieldLocalAction extends DeriverBase implements ContainerDeriverInterface {
  use StringTranslationTrait;
  /**
   * The entity manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;
  /**
   * Constructs a WSFieldLocalAction object.
   *
   * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
   *   The route provider to load routes by name.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity manager.
   */
  public function __construct(RouteProviderInterface $route_provider, EntityTypeManagerInterface $entity_type_manager) {
    $this->routeProvider = $route_provider;
    $this->entityTypeManager = $entity_type_manager;
  }
  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    return new static($container
      ->get('router.route_provider'), $container
      ->get('entity_type.manager'));
  }
  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $this->derivatives = [];
    foreach ($this->entityTypeManager
      ->getDefinitions() as $entity_type_id => $entity_type) {
      if ($entity_type
        ->get('field_ui_base_route')) {
        $this->derivatives["field_wsfield_config_add_{$entity_type_id}"] = [
          'route_name' => "wsdata_field.field_wsfield_config_add_{$entity_type_id}",
          'title' => $this
            ->t('Add web service field'),
          'appears_on' => [
            "entity.{$entity_type_id}.field_ui_fields",
          ],
        ];
      }
    }
    foreach ($this->derivatives as &$entry) {
      $entry += $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:: | |
| 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. | |
| WSFieldLocalAction:: | protected | property | The entity manager. | |
| WSFieldLocalAction:: | public static | function | Creates a new class instance. Overrides ContainerDeriverInterface:: | |
| WSFieldLocalAction:: | public | function | Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: | |
| WSFieldLocalAction:: | public | function | Constructs a WSFieldLocalAction object. | 
