class WorkspacesTestHooks
Hook implementations for workspaces_test.
Hierarchy
- class \Drupal\workspaces_test\Hook\WorkspacesTestHooks
Expanded class hierarchy of WorkspacesTestHooks
File
-
core/
modules/ workspaces/ tests/ modules/ workspaces_test/ src/ Hook/ WorkspacesTestHooks.php, line 12
Namespace
Drupal\workspaces_test\HookView source
class WorkspacesTestHooks {
/**
* Implements hook_entity_type_alter().
*/
public function entityTypeAlter(array &$entity_types) : void {
$state = \Drupal::state();
// Allow all entity types to have their definition changed dynamically for
// testing purposes.
foreach ($entity_types as $entity_type_id => $entity_type) {
$entity_types[$entity_type_id] = $state->get("{$entity_type_id}.entity_type", $entity_types[$entity_type_id]);
}
}
/**
* Implements hook_ENTITY_TYPE_translation_create() for 'entity_test_mulrevpub'.
*/
public function entityTranslationCreate() : void {
/** @var \Drupal\workspaces\WorkspaceManagerInterface $workspace_manager */
$workspace_manager = \Drupal::service('workspaces.manager');
\Drupal::keyValue('ws_test')->set('workspace_was_active', $workspace_manager->hasActiveWorkspace());
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
WorkspacesTestHooks::entityTranslationCreate | public | function | Implements hook_ENTITY_TYPE_translation_create() for 'entity_test_mulrevpub'. |
WorkspacesTestHooks::entityTypeAlter | public | function | Implements hook_entity_type_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.