Skip to content
Snippets Groups Projects
Commit d966092d authored by Jürgen Haas's avatar Jürgen Haas
Browse files

Issue #3278067 by jurgenhaas, mxh: eca_trigger_content_entity_custom_event...

Issue #3278067 by jurgenhaas, mxh: eca_trigger_content_entity_custom_event should handle entity being NULL
parent 7149466b
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,10 @@
namespace Drupal\eca_content\Plugin\Action;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\eca\Plugin\Action\ConfigurableActionBase;
use Drupal\eca_content\Event\ContentEntityCustomEvent;
use Drupal\eca_content\Event\ContentEntityEvents;
......@@ -45,6 +48,17 @@ class TriggerContentEntityCustomEvent extends ConfigurableActionBase {
return $plugin;
}
/**
* {@inheritdoc}
*/
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
if (!($object instanceof ContentEntityInterface)) {
$result = AccessResult::forbidden();
return $return_as_object ? $result : $result->isAllowed();
}
return parent::access($object, $account, $return_as_object);
}
/**
* {@inheritdoc}
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment