You are here

public static function ContentHubSubscriberController::create in Acquia Content Hub 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

acquia_contenthub_subscriber/src/Controller/ContentHubSubscriberController.php, line 97

Class

ContentHubSubscriberController
Controller for Content Hub Discovery page.

Namespace

Drupal\acquia_contenthub_subscriber\Controller

Code

public static function create(ContainerInterface $container) {

  /** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
  $config_factory = $container
    ->get('config.factory');

  /** @var \Drupal\Core\Language\LanguageManagerInterface $language_manager */
  $language_manager = $container
    ->get('language_manager');

  /** @var \Drupal\Core\Access\CsrfTokenGenerator $csrf_token_generator */
  $csrf_token_generator = $container
    ->get('csrf_token');

  /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
  $entity_manager = $container
    ->get('acquia_contenthub.entity_manager');

  /** @var \Drupal\acquia_contenthub\EntityManager $entity_manager */
  $entity_type_manager = $container
    ->get('entity_type.manager');

  /** @var \Drupal\Core\State\StateInterface $state */
  $state = $container
    ->get('state');
  return new static($config_factory, $language_manager, $csrf_token_generator, $entity_manager, $entity_type_manager, $state);
}