class DevelEntityTestHooks
Hook implementations for devel_entity_test.
Hierarchy
- class \Drupal\devel_entity_test\Hook\DevelEntityTestHooks uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of DevelEntityTestHooks
File
-
tests/
modules/ devel_entity_test/ src/ Hook/ DevelEntityTestHooks.php, line 12
Namespace
Drupal\devel_entity_test\HookView source
class DevelEntityTestHooks {
use StringTranslationTrait;
public function __construct(protected readonly EntityTypeManagerInterface $entityTypeManager) {
}
/**
* Implements hook_entity_view_mode_info_alter().
*/
public function entityViewModeInfoAlter(array &$view_modes) : void {
$entity_info = $this->entityTypeManager
->getDefinitions();
foreach ($entity_info as $entity_type => $info) {
if ($info->getProvider() !== 'devel_entity_test_canonical') {
continue;
}
if (isset($view_modes[$entity_type])) {
continue;
}
$view_modes[$entity_type] = [
'full' => [
'label' => $this->t('Full object'),
'status' => TRUE,
'cache' => TRUE,
],
'teaser' => [
'label' => $this->t('Teaser'),
'status' => TRUE,
'cache' => TRUE,
],
];
}
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overrides |
|---|---|---|---|---|
| DevelEntityTestHooks::entityViewModeInfoAlter | public | function | Implements hook_entity_view_mode_info_alter(). | |
| DevelEntityTestHooks::__construct | public | function | ||
| 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. |