diff --git a/modules/paragraphs_library/paragraphs_library.install b/modules/paragraphs_library/paragraphs_library.install index 449730f826b5c7fc146869fed612c524c05f533a..1751ed9f35d929f316552d7edf02921112d06cd0 100644 --- a/modules/paragraphs_library/paragraphs_library.install +++ b/modules/paragraphs_library/paragraphs_library.install @@ -65,7 +65,7 @@ function paragraphs_library_install() { */ function paragraphs_library_update_8001() { - \Drupal::service('entity.manager')->clearCachedDefinitions(); + \Drupal::service('entity_type.manager')->clearCachedDefinitions(); // Load all library items and store their values in memory. $library_values = \Drupal::database()->query('SELECT * FROM {paragraphs_library_item}')->fetchAll(PDO::FETCH_ASSOC); @@ -110,7 +110,7 @@ function paragraphs_library_update_8001() { $entity_definition_update_manager->installFieldStorageDefinition('langcode', $entity_type->id(), 'paragraphs_library', $langcode_field); $entity_definition_update_manager->installFieldStorageDefinition('default_langcode', $entity_type->id(), 'paragraphs_library', $default_langcode_field); - \Drupal::entityManager()->clearCachedDefinitions(); + \Drupal::entityTypeManager()->clearCachedDefinitions(); foreach ($library_values as $library_value) { $library_value['paragraphs'] = [ 'target_id' => $library_value['paragraphs__target_id'], diff --git a/modules/paragraphs_library/src/Form/LibraryItemForm.php b/modules/paragraphs_library/src/Form/LibraryItemForm.php index 7fec8152337ffa5ce1addfeddfba8830df0ec1c1..a2ed4c61247af8cc9de4f678da3d0d9582db9003 100644 --- a/modules/paragraphs_library/src/Form/LibraryItemForm.php +++ b/modules/paragraphs_library/src/Form/LibraryItemForm.php @@ -3,10 +3,10 @@ namespace Drupal\paragraphs_library\Form; use Drupal\Core\Entity\ContentEntityForm; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Messenger\MessengerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Component\Datetime\TimeInterface; @@ -20,30 +20,6 @@ class LibraryItemForm extends ContentEntityForm { */ protected $entity; - /** - * Provides messenger service. - * - * @var \Drupal\Core\Messenger\Messenger - */ - protected $messenger; - - /** - * Constructs a LibraryItemForm object. - * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. - * @param \Drupal\Core\Messenger\MessengerInterface $messenger - * The messenger service. - * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info - * The entity type bundle service. - * @param \Drupal\Component\Datetime\TimeInterface $time - * The time service. - */ - public function __construct(EntityManagerInterface $entity_manager, MessengerInterface $messenger, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) { - parent::__construct($entity_manager, $entity_type_bundle_info, $time); - $this->messenger = $messenger; - } - /** * {@inheritdoc} */ @@ -61,12 +37,9 @@ class LibraryItemForm extends ContentEntityForm { * {@inheritdoc} */ public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager'), - $container->get('messenger'), - $container->get('entity_type.bundle.info'), - $container->get('datetime.time') - ); + $form = parent::create($container); + $form->setMessenger($container->get('messenger')); + return $form; } /** diff --git a/src/Feeds/Target/Paragraphs.php b/src/Feeds/Target/Paragraphs.php index b71cd84ead3cd425258c8e2ae88bcc5a8a8d29eb..e025ad8628bc1dc3d14eb32ee81d301e18cdb39a 100644 --- a/src/Feeds/Target/Paragraphs.php +++ b/src/Feeds/Target/Paragraphs.php @@ -15,7 +15,7 @@ use Drupal\feeds\Plugin\Type\Target\ConfigurableTargetInterface; * @FeedsTarget( * id = "paragraphs", * field_types = {"entity_reference_revisions"}, - * arguments = {"@entity.manager", "@current_user"} + * arguments = {"@entity_type.manager", "@current_user"} * ) */ class Paragraphs extends Text implements ConfigurableTargetInterface { diff --git a/src/Plugin/EntityReferenceSelection/ParagraphSelection.php b/src/Plugin/EntityReferenceSelection/ParagraphSelection.php index e1708769076d9597d8a0dcb06710dd9a1bfcb177..f0431281bfdc8958cbdd92bbc46f1dda218cd073 100644 --- a/src/Plugin/EntityReferenceSelection/ParagraphSelection.php +++ b/src/Plugin/EntityReferenceSelection/ParagraphSelection.php @@ -2,8 +2,8 @@ namespace Drupal\paragraphs\Plugin\EntityReferenceSelection; -use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Session\AccountInterface; @@ -25,52 +25,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class ParagraphSelection extends DefaultSelection { - /** - * Entity type bundle info service. - * - * @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface - */ - public $entityTypeBundleInfo; - - /** - * ParagraphSelection constructor. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager service. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler service. - * @param \Drupal\Core\Session\AccountInterface $current_user - * The current user. - * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info - * Entity type bundle info service. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, EntityTypeBundleInfoInterface $entity_type_bundle_info) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_manager, $module_handler, $current_user); - - $this->entityTypeBundleInfo = $entity_type_bundle_info; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity.manager'), - $container->get('module_handler'), - $container->get('current_user'), - $container->get('entity_type.bundle.info') - ); - } - /** * {@inheritdoc} */ @@ -297,9 +251,9 @@ class ParagraphSelection extends DefaultSelection { protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') { $target_type = $this->configuration['target_type']; $handler_settings = $this->configuration['handler_settings']; - $entity_type = $this->entityManager->getDefinition($target_type); + $entity_type = $this->entityTypeManager->getDefinition($target_type); - $query = $this->entityManager->getStorage($target_type)->getQuery(); + $query = $this->entityTypeManager->getStorage($target_type)->getQuery(); // If 'target_bundles' is NULL, all bundles are referenceable, no further // conditions are needed. diff --git a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php index 2312d14e590f12d746410b2cb72837ee23db8fe2..dd862b2b921ea3873f321968d5fe0e5cb9f0b9c5 100644 --- a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php +++ b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php @@ -230,7 +230,7 @@ class InlineParagraphsWidget extends WidgetBase { $host = $items->getEntity(); $widget_state = static::getWidgetState($parents, $field_name, $form_state); - $entity_manager = \Drupal::entityTypeManager(); + $entity_type_manager = \Drupal::entityTypeManager(); $target_type = $this->getFieldSetting('target_type'); $item_mode = isset($widget_state['paragraphs'][$delta]['mode']) ? $widget_state['paragraphs'][$delta]['mode'] : 'edit'; @@ -260,10 +260,10 @@ class InlineParagraphsWidget extends WidgetBase { } elseif (isset($widget_state['selected_bundle'])) { - $entity_type = $entity_manager->getDefinition($target_type); + $entity_type = $entity_type_manager->getDefinition($target_type); $bundle_key = $entity_type->getKey('bundle'); - $paragraphs_entity = $entity_manager->getStorage($target_type)->create(array( + $paragraphs_entity = $entity_type_manager->getStorage($target_type)->create(array( $bundle_key => $widget_state['selected_bundle'], )); $paragraphs_entity->setParentEntity($items->getEntity(), $field_name); diff --git a/src/Plugin/migrate/source/DrupalSqlBase.php b/src/Plugin/migrate/source/DrupalSqlBase.php index b62936945798252263eb1b40e668d26034073e9a..04a763e37442ae83d765d703671bc84524e9ae93 100644 --- a/src/Plugin/migrate/source/DrupalSqlBase.php +++ b/src/Plugin/migrate/source/DrupalSqlBase.php @@ -20,8 +20,8 @@ abstract class DrupalSqlBase extends MigrateDrupalSqlBase implements Configurabl /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager); + public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager); $this->setConfiguration($configuration); } diff --git a/src/Plugin/migrate/source/d7/FieldableEntity.php b/src/Plugin/migrate/source/d7/FieldableEntity.php index ff3e8a731673529dbd512ac7e34796af42851f04..dde750a6ca8c9fed95234e4046e2402df7af0668 100644 --- a/src/Plugin/migrate/source/d7/FieldableEntity.php +++ b/src/Plugin/migrate/source/d7/FieldableEntity.php @@ -20,8 +20,8 @@ abstract class FieldableEntity extends MigrateFieldableEntity implements Configu /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager); + public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager); $this->setConfiguration($configuration); }