function node_test_entity_view_mode_alter
Same name in other branches
- 7.x modules/node/tests/node_test.module \node_test_entity_view_mode_alter()
- 9 core/modules/node/tests/modules/node_test/node_test.module \node_test_entity_view_mode_alter()
- 10 core/modules/node/tests/modules/node_test/node_test.module \node_test_entity_view_mode_alter()
- 11.x core/modules/node/tests/modules/node_test/node_test.module \node_test_entity_view_mode_alter()
Implements hook_entity_view_mode_alter().
File
-
core/
modules/ node/ tests/ modules/ node_test/ node_test.module, line 156
Code
function node_test_entity_view_mode_alter(&$view_mode, EntityInterface $entity, $context) {
// Only alter the view mode if we are on the test callback.
$change_view_mode = \Drupal::state()->get('node_test_change_view_mode') ?: '';
if ($change_view_mode) {
$view_mode = $change_view_mode;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.