Commit 9e12a609 authored by mxh's avatar mxh Committed by Sascha Grossenbacher
Browse files

Issue #3322747 by mxh: Action plugins cannot be instantiated in a generic way

parent 97aada74
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -57,6 +57,13 @@ class FlagAction extends ActionBase implements ContainerFactoryPluginInterface,
   *   The flag service.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, FlagServiceInterface $flag_service) {
    if (!isset($configuration['flag_id'], $configuration['flag_action'])) {
      // When not specified otherwise, use the information of the plugin
      // definition, as provided by the deriver.
      $configuration['flag_id'] = $plugin_definition['flag_id'];
      $configuration['flag_action'] = $plugin_definition['flag_action'];
    }

    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->flagService = $flag_service;
    $this->flag = $this->flagService->getFlagById($configuration['flag_id']);
+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ class EntityFlagActionDeriver extends DeriverBase implements ContainerDeriverInt
      foreach (['flag', 'unflag'] as $action) {
        $this->derivatives[$flag_id . '_' . $action] = [
          'id' => $flag_id . '_' . $action,
          'flag_id' => $flag_id,
          'flag_action' => $action,
          'label' => $flag->getShortText($action),
          'type' => $flag->getFlaggableEntityTypeId(),
        ] + $base_plugin_definition;