diff --git a/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php b/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php index e0e7e4b..35e5f88 100644 --- a/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php +++ b/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php @@ -6,7 +6,6 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Entity\RevisionableInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldItemListInterface; diff --git a/src/WidgetSubmit.php b/src/WidgetSubmit.php index 6168929..42f1c51 100644 --- a/src/WidgetSubmit.php +++ b/src/WidgetSubmit.php @@ -3,8 +3,10 @@ namespace Drupal\inline_entity_form; use Drupal\Core\Entity\RevisionableInterface; +use Drupal\Core\Entity\RevisionLogInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\inline_entity_form\Element\InlineEntityForm; +use Drupal\node\NodeInterface; /** * Performs widget submission. @@ -49,12 +51,12 @@ class WidgetSubmit { $handler = InlineEntityForm::getInlineFormHandler($entity->getEntityTypeId()); if ($entity instanceof RevisionableInterface && $entity->getEntityType()->isRevisionable()) { $entity->setNewRevision(); - if (in_array('Drupal\node\NodeInterface', class_implements($entity))) { + if ($entity instanceof NodeInterface) { $entity->setRevisionCreationTime(REQUEST_TIME); // If a new revision is created, save the current user as revision author. $entity->setRevisionAuthorId(\Drupal::currentUser()->id()); } - elseif (in_array('Drupal\entity\Revision\EntityRevisionLogInterface', class_implements($entity))) { + elseif ($entity instanceof RevisionLogInterface) { // If a new revision is created, save the current user as revision author. $entity->setRevisionUserId(\Drupal::currentUser()->id()); $entity->setRevisionCreationTime(REQUEST_TIME);