You are here

public static function HomeboxLayoutController::create in Homebox 8

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.

Overrides ControllerBase::create

File

src/Controller/HomeboxLayoutController.php, line 80

Class

HomeboxLayoutController
Class HomeboxLayoutController.

Namespace

Drupal\homebox\Controller

Code

public static function create(ContainerInterface $container) {

  /* @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */
  $date_formatter = $container
    ->get('date.formatter');

  /* @var \Drupal\Core\Render\RendererInterface $renderer */
  $renderer = $container
    ->get('renderer');

  /* @var \Drupal\Core\Block\BlockManagerInterface $block_manager */
  $block_manager = $container
    ->get('plugin.manager.block');

  /* @var \Drupal\Core\Menu\LocalActionManagerInterface $local_action_manager */
  $local_action_manager = $container
    ->get('plugin.manager.menu.local_action');

  /* @var \Drupal\Core\Routing\RouteMatchInterface $route_match */
  $route_match = $container
    ->get('current_route_match');

  /* @var \Drupal\Core\Plugin\Context\LazyContextRepository $context_repository */
  $context_repository = $container
    ->get('context.repository');

  /** @var \Drupal\Core\Utility\LinkGeneratorInterface $link_generator */
  $link_generator = $container
    ->get('link_generator');
  return new static($date_formatter, $renderer, $block_manager, $local_action_manager, $route_match, $context_repository, $link_generator);
}