class WorkspacesUiHooks
Same name and namespace in other branches
- 11.x core/modules/workspaces_ui/src/Hook/WorkspacesUiHooks.php \Drupal\workspaces_ui\Hook\WorkspacesUiHooks
Hook implementations for the workspaces_ui module.
Hierarchy
- class \Drupal\workspaces_ui\Hook\WorkspacesUiHooks uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of WorkspacesUiHooks
File
-
core/
modules/ workspaces_ui/ src/ Hook/ WorkspacesUiHooks.php, line 21
Namespace
Drupal\workspaces_ui\HookView source
class WorkspacesUiHooks {
use StringTranslationTrait;
/**
* Implements hook_entity_type_alter().
*/
public function entityTypeAlter(array &$entity_types) : void {
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
if (isset($entity_types['workspace'])) {
$entity_types['workspace']->setHandlerClass('list_builder', WorkspaceListBuilder::class);
$entity_types['workspace']->setHandlerClass('view_builder', WorkspaceViewBuilder::class);
$entity_types['workspace']->setHandlerClass('route_provider', [
'html' => AdminHtmlRouteProvider::class,
]);
$entity_types['workspace']->setFormClass('default', WorkspaceForm::class);
$entity_types['workspace']->setFormClass('add', WorkspaceForm::class);
$entity_types['workspace']->setFormClass('edit', WorkspaceForm::class);
$entity_types['workspace']->setFormClass('delete', WorkspaceDeleteForm::class);
$entity_types['workspace']->setFormClass('activate', WorkspaceActivateForm::class);
$entity_types['workspace']->setLinkTemplate('canonical', '/admin/config/workflow/workspaces/manage/{workspace}');
$entity_types['workspace']->setLinkTemplate('add-form', '/admin/config/workflow/workspaces/add');
$entity_types['workspace']->setLinkTemplate('edit-form', '/admin/config/workflow/workspaces/manage/{workspace}/edit');
$entity_types['workspace']->setLinkTemplate('delete-form', '/admin/config/workflow/workspaces/manage/{workspace}/delete');
$entity_types['workspace']->setLinkTemplate('activate-form', '/admin/config/workflow/workspaces/manage/{workspace}/activate');
$entity_types['workspace']->setLinkTemplate('collection', '/admin/config/workflow/workspaces');
$entity_types['workspace']->set('field_ui_base_route', 'entity.workspace.collection');
}
}
/**
* Implements hook_help().
*/
public function help($route_name, RouteMatchInterface $route_match) : ?string {
switch ($route_name) {
// Main module help for the Workspaces UI module.
case 'help.page.workspaces_ui':
$output = '';
$output .= '<h2>' . $this->t('About') . '</h2>';
$output .= '<p>' . $this->t('The Workspaces UI module provides an interface for managing workspaces for the <a href=":workspaces_module">Workspaces module</a>. For more information, see the <a href=":workspaces">online documentation for the Workspaces UI module</a>.', [
':workspaces_module' => Url::fromRoute('help.page', [
'name' => 'workspaces',
])->toString(),
':workspaces' => 'https://www.drupal.org/docs/8/core/modules/workspace/overview',
]) . '</p>';
return $output;
}
return NULL;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overrides |
|---|---|---|---|---|
| StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 |
| StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | |
| StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | |
| StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | |
| StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 |
| StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | 1 |
| WorkspacesUiHooks::entityTypeAlter | public | function | Implements hook_entity_type_alter(). | |
| WorkspacesUiHooks::help | public | function | Implements hook_help(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.