function ToolbarController::__construct

Same name and namespace in other branches
  1. 11.x core/modules/toolbar/src/Controller/ToolbarController.php \Drupal\toolbar\Controller\ToolbarController::__construct()

Constructs a ToolbarController object.

Parameters

\Drupal\Component\Datetime\TimeInterface|null $time: The time service.

File

core/modules/toolbar/src/Controller/ToolbarController.php, line 26

Class

ToolbarController
Defines a controller for the toolbar module.

Namespace

Drupal\toolbar\Controller

Code

public function __construct(?TimeInterface $time = NULL) {
    if ($this->time === NULL) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $time argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3112298', E_USER_DEPRECATED);
        $this->time = \Drupal::service('datetime.time');
    }
}

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