Commit 0b669e62 authored by larowlan's avatar larowlan Committed by larowlan

Issue #2936656 by larowlan: Argument 4 passed to...

Issue #2936656 by larowlan: Argument 4 passed to Drupal\node\Plugin\Action\PublishNode::__construct() must implement interface Drupal\Core\Entity\EntityTypeManagerInterface, none given
parent 07829ec0
......@@ -3,6 +3,7 @@
namespace Drupal\workbench_moderation\Plugin\Action;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\Plugin\Action\PublishNode;
......@@ -21,8 +22,8 @@ class ModerationOptOutPublishNode extends PublishNode implements ContainerFactor
*/
protected $moderationInfo;
public function __construct(array $configuration, $plugin_id, $plugin_definition, ModerationInformationInterface $mod_info) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
public function __construct(array $configuration, $plugin_id, $plugin_definition, ModerationInformationInterface $mod_info, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager);
$this->moderationInfo = $mod_info;
}
......@@ -32,7 +33,8 @@ class ModerationOptOutPublishNode extends PublishNode implements ContainerFactor
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration, $plugin_id, $plugin_definition,
$container->get('workbench_moderation.moderation_information')
$container->get('workbench_moderation.moderation_information'),
$container->get('entity_type.manager')
);
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\workbench_moderation\Plugin\Action;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\Plugin\Action\UnpublishNode;
......@@ -21,8 +22,8 @@ class ModerationOptOutUnpublishNode extends UnpublishNode implements ContainerFa
*/
protected $moderationInfo;
public function __construct(array $configuration, $plugin_id, $plugin_definition, ModerationInformationInterface $mod_info) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
public function __construct(array $configuration, $plugin_id, $plugin_definition, ModerationInformationInterface $mod_info, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager);
$this->moderationInfo = $mod_info;
}
......@@ -32,7 +33,8 @@ class ModerationOptOutUnpublishNode extends UnpublishNode implements ContainerFa
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration, $plugin_id, $plugin_definition,
$container->get('workbench_moderation.moderation_information')
$container->get('workbench_moderation.moderation_information'),
$container->get('entity_type.manager')
);
}
......
......@@ -10,6 +10,8 @@
*/
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Action\Plugin\Action\PublishAction;
use Drupal\Core\Action\Plugin\Action\UnpublishAction;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
......@@ -212,6 +214,12 @@ function workbench_moderation_action_info_alter(&$definitions) {
if (isset($definitions['node_unpublish_action']['class']) && $definitions['node_unpublish_action']['class'] == UnpublishNode::class) {
$definitions['node_unpublish_action']['class'] = ModerationOptOutUnpublishNode::class;
}
if (isset($definitions['entity:publish_action:node']['class']) && $definitions['entity:publish_action:node']['class'] == PublishAction::class) {
$definitions['entity:publish_action:node']['class'] = ModerationOptOutPublishNode::class;
}
if (isset($definitions['entity:unpublish_action:node']['class']) && $definitions['entity:unpublish_action:node']['class'] == UnpublishAction::class) {
$definitions['entity:publish_action:node']['class'] = ModerationOptOutUnpublishNode::class;
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment