class NodeHierarchyEventSubscriber in Entity Reference Hierarchy 8
Hierarchy
- class \Drupal\entity_hierarchy\EventSubscriber\NodeHierarchyEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of NodeHierarchyEventSubscriber
1 string reference to 'NodeHierarchyEventSubscriber'
1 service uses NodeHierarchyEventSubscriber
File
- src/
EventSubscriber/ NodeHierarchyEventSubscriber.php, line 23 - Contains \Drupal\entity_hierarchy\EventSubscriber\NodeHierarchyEventSubscriber.
Namespace
Drupal\entity_hierarchy\EventSubscriberView source
class NodeHierarchyEventSubscriber implements EventSubscriberInterface {
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Constructs a NodeHierarchyEventSubscriber object.
*/
public function __construct(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
/**
* Initializes Entity Hierarchy module requirements.
*/
public function onRequest(GetResponseEvent $event) {
// Ensure we are not serving a cached page.
if (function_exists('drupalSetContent')) {
if ($this->moduleHandler
->moduleExists('token')) {
include_once DRUPAL_ROOT . '/' . libraries_get_path('module', 'entity_hierarchy') . '/includes/entity_hierarchy_token.inc';
}
if ($this->moduleHandler
->moduleExists('workflow_ng')) {
include_once DRUPAL_ROOT . '/' . libraries_get_path('module', 'entity_hierarchy') . '/includes/entity_hierarchy_workflow_ng.inc';
}
}
}
/**
* Prevents page redirection so that the developer can see the intermediate debug data.
* @param FilterResponseEvent $event
*/
public function onResponse(FilterResponseEvent $event) {
$response = $event
->getResponse();
}
/**
* Implements EventSubscriberInterface::getSubscribedEvents().
*
* @return array
* An array of event listener definitions.
*/
static function getSubscribedEvents() {
// Set a low value to start as early as possible.
$events[KernelEvents::REQUEST][] = array(
'onRequest',
-100,
);
// Why only large positive value works here?
$events[KernelEvents::RESPONSE][] = array(
'onResponse',
1000,
);
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NodeHierarchyEventSubscriber:: |
protected | property | The module handler. | |
NodeHierarchyEventSubscriber:: |
static | function | Implements EventSubscriberInterface::getSubscribedEvents(). | |
NodeHierarchyEventSubscriber:: |
public | function | Initializes Entity Hierarchy module requirements. | |
NodeHierarchyEventSubscriber:: |
public | function | Prevents page redirection so that the developer can see the intermediate debug data. | |
NodeHierarchyEventSubscriber:: |
public | function | Constructs a NodeHierarchyEventSubscriber object. |