Commit b3c5451d authored by Sascha Grossenbacher's avatar Sascha Grossenbacher Committed by Damien McKenna
Browse files

Issue #3042590 by Berdir: Reworked NodewordsFieldInstance to make it compatible with core 8.7.

parent 68717feb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx
  migration_tags.
#3124042 by Neslee Canil Pinto: t() calls should be avoided in classes, use
  \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead.
#3042590 by Berdir: Reworked NodewordsFieldInstance to make it compatible with
  core 8.7.


Metatag 8.x-1.12, 2020-03-30
+14 −16
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\metatag\Plugin\migrate\source\d6;

use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -17,33 +18,30 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class NodewordsFieldInstance extends DrupalSqlBase {

  /**
   * The EntityTypeBundleInfo for this entity type.
   * The entity type bundle service.
   *
   * @var \Drupal\Core\Entity\EntityTypeBundleInfo
   * @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
   */
  protected $entityTypeBundleInfo;

  /**
   * {@inheritdoc}
   */
  public function __construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager, $entity_type_bundle_info) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager);
    $this->entityTypeBundleInfo = $entity_type_bundle_info;
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
    /** @var static $source */
    $source = parent::create($container, $configuration, $plugin_id, $plugin_definition, $migration);
    $source->setEntityTypeBundleInfo($container->get('entity_type.bundle.info'));
    return $source;
  }

  /**
   * {@inheritdoc}
   * Sets the entity type bundle info service.
   *
   * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
   *   The entity type bundle info service.
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $migration,
      $container->get('state'),
      $container->get('entity_type.manager'),
      $container->get('entity_type.bundle.info')
    );
  public function setEntityTypeBundleInfo(EntityTypeBundleInfoInterface $entity_type_bundle_info) {
    $this->entityTypeBundleInfo = $entity_type_bundle_info;
  }

  /**