Skip to content
Snippets Groups Projects
Commit e41064e4 authored by Owen Bush's avatar Owen Bush Committed by Owen Bush
Browse files

Issue #3114432 by owenbush, kducharm: Moderation form alter can throw error

parent 4e506aa2
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ use Drupal\Core\Entity\EntityInterface; ...@@ -10,6 +10,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Render\Element; use Drupal\Core\Render\Element;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\recurring_events\Entity\EventSeries; use Drupal\recurring_events\Entity\EventSeries;
use Drupal\recurring_events\EventInterface;
use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface; use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface;
use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Entity\FieldableEntityInterface;
...@@ -464,7 +465,7 @@ function recurring_events_form_alter(&$form, FormStateInterface $form_state, $fo ...@@ -464,7 +465,7 @@ function recurring_events_form_alter(&$form, FormStateInterface $form_state, $fo
*/ */
function recurring_events_form_content_moderation_entity_moderation_form_alter(&$form, FormStateInterface $form_state) { function recurring_events_form_content_moderation_entity_moderation_form_alter(&$form, FormStateInterface $form_state) {
$entity = $form_state->get('entity'); $entity = $form_state->get('entity');
if ($entity->getEntityTypeId() === 'eventseries') { if ($entity instanceof EventInterface && $entity->getEntityTypeId() === 'eventseries') {
$original = \Drupal::entityTypeManager()->getStorage('eventseries')->load($entity->id()); $original = \Drupal::entityTypeManager()->getStorage('eventseries')->load($entity->id());
$creation_service = \Drupal::service('recurring_events.event_creation_service'); $creation_service = \Drupal::service('recurring_events.event_creation_service');
if ($creation_service->checkForOriginalRecurConfigChanges($entity, $original)) { if ($creation_service->checkForOriginalRecurConfigChanges($entity, $original)) {
......
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