function EntityTestHooks::entityTestViewModeAlter

Implements hook_ENTITY_TYPE_view_mode_alter().

File

core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php, line 196

Class

EntityTestHooks
Hook implementations for entity_test.

Namespace

Drupal\entity_test\Hook

Code

public function entityTestViewModeAlter(string &$view_mode, EntityInterface $entity) : void {
    if ($view_mode == 'entity_test.vm_alter_test') {
        $view_mode = 'entity_test.vm_alter_full';
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.