|
|
@ -5,6 +5,7 @@ namespace Drupal\islandora\EventGenerator; |
|
|
|
use Drupal\Core\Access\AccessResult; |
|
|
|
use Drupal\Core\Access\AccessResult; |
|
|
|
use Drupal\Core\Action\ConfigurableActionBase; |
|
|
|
use Drupal\Core\Action\ConfigurableActionBase; |
|
|
|
use Drupal\Core\Entity\EntityInterface; |
|
|
|
use Drupal\Core\Entity\EntityInterface; |
|
|
|
|
|
|
|
use Drupal\Core\Messenger\MessengerInterface; |
|
|
|
use Drupal\Core\Entity\EntityTypeManagerInterface; |
|
|
|
use Drupal\Core\Entity\EntityTypeManagerInterface; |
|
|
|
use Drupal\Core\Form\FormStateInterface; |
|
|
|
use Drupal\Core\Form\FormStateInterface; |
|
|
|
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
|
|
|
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
|
|
@ -55,6 +56,13 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected $auth; |
|
|
|
protected $auth; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* The messenger. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @var \Drupal\Core\Messenger\MessengerInterface |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private $messenger; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Constructs a EmitEvent action. |
|
|
|
* Constructs a EmitEvent action. |
|
|
|
* |
|
|
|
* |
|
|
@ -74,6 +82,8 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact |
|
|
|
* Stomp client. |
|
|
|
* Stomp client. |
|
|
|
* @param \Drupal\jwt\Authentication\Provider\JwtAuth $auth |
|
|
|
* @param \Drupal\jwt\Authentication\Provider\JwtAuth $auth |
|
|
|
* JWT Auth client. |
|
|
|
* JWT Auth client. |
|
|
|
|
|
|
|
* @param \Drupal\Core\Messenger\MessengerInterface $messenger |
|
|
|
|
|
|
|
* The messenger. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function __construct( |
|
|
|
public function __construct( |
|
|
|
array $configuration, |
|
|
|
array $configuration, |
|
|
@ -83,7 +93,8 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact |
|
|
|
EntityTypeManagerInterface $entity_type_manager, |
|
|
|
EntityTypeManagerInterface $entity_type_manager, |
|
|
|
EventGeneratorInterface $event_generator, |
|
|
|
EventGeneratorInterface $event_generator, |
|
|
|
StatefulStomp $stomp, |
|
|
|
StatefulStomp $stomp, |
|
|
|
JwtAuth $auth |
|
|
|
JwtAuth $auth, |
|
|
|
|
|
|
|
MessengerInterface $messenger |
|
|
|
) { |
|
|
|
) { |
|
|
|
parent::__construct($configuration, $plugin_id, $plugin_definition); |
|
|
|
parent::__construct($configuration, $plugin_id, $plugin_definition); |
|
|
|
$this->account = $account; |
|
|
|
$this->account = $account; |
|
|
@ -91,6 +102,7 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact |
|
|
|
$this->eventGenerator = $event_generator; |
|
|
|
$this->eventGenerator = $event_generator; |
|
|
|
$this->stomp = $stomp; |
|
|
|
$this->stomp = $stomp; |
|
|
|
$this->auth = $auth; |
|
|
|
$this->auth = $auth; |
|
|
|
|
|
|
|
$this->messenger = $messenger; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -121,7 +133,7 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact |
|
|
|
\Drupal::logger('islandora')->error( |
|
|
|
\Drupal::logger('islandora')->error( |
|
|
|
t('Error getting JWT token for message. Check JWT Configuration.') |
|
|
|
t('Error getting JWT token for message. Check JWT Configuration.') |
|
|
|
); |
|
|
|
); |
|
|
|
drupal_set_message( |
|
|
|
$this->messenger->addMessage( |
|
|
|
t('Error getting JWT token for message. Check JWT Configuration.'), 'error' |
|
|
|
t('Error getting JWT token for message. Check JWT Configuration.'), 'error' |
|
|
|
); |
|
|
|
); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -141,7 +153,7 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact |
|
|
|
\Drupal::logger('islandora')->error( |
|
|
|
\Drupal::logger('islandora')->error( |
|
|
|
t('Error generating event: @msg', ['@msg' => $e->getMessage()]) |
|
|
|
t('Error generating event: @msg', ['@msg' => $e->getMessage()]) |
|
|
|
); |
|
|
|
); |
|
|
|
drupal_set_message( |
|
|
|
$this->messenger->addMessage( |
|
|
|
t('Error generating event: @msg', ['@msg' => $e->getMessage()]), |
|
|
|
t('Error generating event: @msg', ['@msg' => $e->getMessage()]), |
|
|
|
'error' |
|
|
|
'error' |
|
|
|
); |
|
|
|
); |
|
|
@ -162,7 +174,7 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Notify user. |
|
|
|
// Notify user. |
|
|
|
drupal_set_message( |
|
|
|
$this->messenger->addMessage( |
|
|
|
t('Error publishing message: @msg', |
|
|
|
t('Error publishing message: @msg', |
|
|
|
['@msg' => $e->getMessage()] |
|
|
|
['@msg' => $e->getMessage()] |
|
|
|
), |
|
|
|
), |
|
|
|