function ShortcutLazyBuilders::__construct

Same name in other branches
  1. 9 core/modules/shortcut/src/ShortcutLazyBuilders.php \Drupal\shortcut\ShortcutLazyBuilders::__construct()
  2. 8.9.x core/modules/shortcut/src/ShortcutLazyBuilders.php \Drupal\shortcut\ShortcutLazyBuilders::__construct()
  3. 11.x core/modules/shortcut/src/ShortcutLazyBuilders.php \Drupal\shortcut\ShortcutLazyBuilders::__construct()

Constructs a new ShortcutLazyBuilders object.

Parameters

\Drupal\Core\Render\RendererInterface $renderer: The renderer service.

\Drupal\Core\Entity\EntityTypeManagerInterface|null $entityTypeManager: The entity type manager.

\Drupal\Core\Session\AccountInterface|null $currentUser: The current user.

File

core/modules/shortcut/src/ShortcutLazyBuilders.php, line 33

Class

ShortcutLazyBuilders
Lazy builders for the shortcut module.

Namespace

Drupal\shortcut

Code

public function __construct(RendererInterface $renderer, ?EntityTypeManagerInterface $entityTypeManager, ?AccountInterface $currentUser) {
    $this->renderer = $renderer;
    if (!isset($this->entityTypeManager)) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $entityTypeManager argument is deprecated in drupal:10.3.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3427050', E_USER_DEPRECATED);
        $this->entityTypeManager = \Drupal::entityTypeManager();
    }
    if (!isset($this->currentUser)) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $currentUser argument is deprecated in drupal:10.3.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3427050', E_USER_DEPRECATED);
        $this->currentUser = \Drupal::currentUser();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.