Issues/3407912: Add hook_ENTITY_TYPE_view_mode_alter().
4 unresolved threads
Closes #3407912
Merge request reports
Activity
added 1 commit
added 1 commit
added 75 commits
-
97207445...6edfeb38 - 71 commits from branch
project:11.x
- 4e3b99c0 - Issues/3407912: Add hook_ENTITY_TYPE_view_mode_alter().
- 4efa715e - Issues/3407912: Add hook_ENTITY_TYPE_view_mode_alter().
- 0521270d - Issue #3407912: Add a hook_ENTITY_TYPE_view_mode_alter()
- 7fc0b658 - Issue #3407912: Add a hook_ENTITY_TYPE_view_mode_alter()
Toggle commit list-
97207445...6edfeb38 - 71 commits from branch
308 308 $this->assertStringContainsString('Text in Spanish', (string) $rendered_reference_field_spanish); 309 309 } 310 310 311 /** 312 * Tests a view mode alter on an entity. 313 */ 314 public function testHookEntityTypeViewModeAlter() { changed this line in version 5 of the diff
1697 1697 } 1698 1698 } 1699 1699 1700 /** 1701 * Change the view mode of a particular entity type that is being displayed. 1702 * 1703 * @param string $view_mode 1704 * The view_mode that is to be used to display the entity. 1705 * @param \Drupal\Core\Entity\EntityInterface $entity 1706 * The entity that is being viewed. 1707 * 1708 * @ingroup entity_crud 1709 */ 1710 function hook_ENTITY_TYPE_view_mode_alter(&$view_mode, \Drupal\Core\Entity\EntityInterface $entity) { changed this line in version 5 of the diff
294 294 } 295 295 } 296 296 297 /** 298 * Implements hook_ENTITY_TYPE_view_mode_alter(). 299 */ 300 function entity_test_entity_test_view_mode_alter(&$view_mode, EntityInterface $entity) { changed this line in version 5 of the diff
added 1 commit
- 8adbb4c2 - Addressed review comments, rephrase hook docblock
176 176 */ 177 177 protected function getBuildDefaults(EntityInterface $entity, $view_mode) { 178 178 // Allow modules to change the view mode. 179 $this->moduleHandler()->alter('entity_view_mode', $view_mode, $entity); 179 $entityType = $this->entityTypeId; 180 $this->moduleHandler()->alter([$entityType . '_view_mode', 'entity_view_mode'], $view_mode, $entity);
Please register or sign in to reply