You are here

public function MenuParentFormSelector::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuParentFormSelector.php \Drupal\Core\Menu\MenuParentFormSelector::__construct()

Constructs a \Drupal\Core\Menu\MenuParentFormSelector

Parameters

\Drupal\Core\Menu\MenuLinkTreeInterface $menu_link_tree: The menu link tree service.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager service.

\Drupal\Core\StringTranslation\TranslationInterface $string_translation: The string translation service.

File

core/lib/Drupal/Core/Menu/MenuParentFormSelector.php, line 51

Class

MenuParentFormSelector
Default implementation of the menu parent form selector service.

Namespace

Drupal\Core\Menu

Code

public function __construct(MenuLinkTreeInterface $menu_link_tree, EntityTypeManagerInterface $entity_type_manager, TranslationInterface $string_translation) {
  $this->menuLinkTree = $menu_link_tree;
  if ($entity_type_manager instanceof EntityManagerInterface) {
    @trigger_error('Passing the entity.manager service to MenuParentFormSelector::__construct() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Pass the new dependencies instead. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $this->entityTypeManager = \Drupal::entityTypeManager();
  }
  else {
    $this->entityTypeManager = $entity_type_manager;
  }
  $this->stringTranslation = $string_translation;
}