You are here

public function BehaviorInvoker::__construct in Rabbit Hole 8

Same name and namespace in other branches
  1. 2.x src/BehaviorInvoker.php \Drupal\rabbit_hole\BehaviorInvoker::__construct()

BehaviorInvoker constructor.

Parameters

\Drupal\rabbit_hole\BehaviorSettingsManager $rabbit_hole_behavior_settings_manager: Behavior settings manager.

\Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginManager $plugin_manager_rabbit_hole_behavior_plugin: Behavior plugin manager.

\Drupal\rabbit_hole\Plugin\RabbitHoleEntityPluginManager $plugin_manager_rabbit_hole_entity_plugin: Entity plugin manager.

\Drupal\rabbit_hole\EntityExtender $entity_extender: Entity extender service.

\Drupal\Core\Session\AccountProxyInterface $current_user: The current user.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

File

src/BehaviorInvoker.php, line 77

Class

BehaviorInvoker
Default implementation of Rabbit Hole behaviors invoker.

Namespace

Drupal\rabbit_hole

Code

public function __construct(BehaviorSettingsManager $rabbit_hole_behavior_settings_manager, RabbitHoleBehaviorPluginManager $plugin_manager_rabbit_hole_behavior_plugin, RabbitHoleEntityPluginManager $plugin_manager_rabbit_hole_entity_plugin, EntityExtender $entity_extender, AccountProxyInterface $current_user, ModuleHandlerInterface $module_handler = NULL) {
  $this->rhBehaviorSettingsManager = $rabbit_hole_behavior_settings_manager;
  $this->rhBehaviorPluginManager = $plugin_manager_rabbit_hole_behavior_plugin;
  $this->rhEntityPluginManager = $plugin_manager_rabbit_hole_entity_plugin;
  $this->rhEntityExtender = $entity_extender;
  $this->currentUser = $current_user;
  if (!$module_handler) {
    @trigger_error('The module_handler service must be passed to ' . __NAMESPACE__ . '\\BehaviorInvoker::__construct(). It was added in 8.x-1.0-beta8 and will be required in 2.0 version.', E_USER_DEPRECATED);
    $module_handler = \Drupal::moduleHandler();
  }
  $this->moduleHandler = $module_handler;
}