You are here

public function ConfigEntityRevisionsConverterBase::__construct in Config Entity Revisions 8.2

Constructs a new converter.

Parameters

\Drupal\Core\Entity\EntityManagerInterface $entityManager: The entity manager.

\Drupal\Core\Config\ConfigFactoryInterface $configFactory: The config factory.

\Drupal\Core\TempStore\SharedTempStoreFactory $tempStoreFactory: The factory for the temp store object.

\Drupal\Core\Routing\AdminContext $adminContext: The admin context.

Overrides AdminPathConfigEntityConverter::__construct

File

src/ConfigEntityRevisionsConverterBase.php, line 100

Class

ConfigEntityRevisionsConverterBase
Parameter converter for upcasting entity IDs to full objects.

Namespace

Drupal\config_entity_revisions

Code

public function __construct(EntityManagerInterface $entityManager, ConfigFactoryInterface $configFactory, SharedTempStoreFactory $tempStoreFactory = NULL, AdminContext $adminContext = NULL) {

  // The config factory and admin context are new arguments due to changing
  // the parent. Avoid an error on updated sites by falling back to getting
  // them from the container.
  // @todo Remove in 8.2.x in https://www.drupal.org/node/2674328.
  if (!$configFactory) {
    $configFactory = \Drupal::configFactory();
  }
  if (!$adminContext) {
    $adminContext = \Drupal::service('router.admin_context');
  }
  parent::__construct($entityManager, $configFactory, $adminContext);
  $this->tempStoreFactory = $tempStoreFactory;
}