function amp_entity_view_mode_alter in Accelerated Mobile Pages (AMP) 8
Same name and namespace in other branches
- 8.3 amp.module \amp_entity_view_mode_alter()
- 8.2 amp.module \amp_entity_view_mode_alter()
- 7 amp.module \amp_entity_view_mode_alter()
Implements hook_entity_view_mode_alter().
File
- ./
amp.module, line 32
Code
function amp_entity_view_mode_alter(&$view_mode, EntityInterface $entity, $context) {
$amp_context = \Drupal::service('router.amp_context');
// If on AMP route, and in full view mode, switch to AMP view mode.
if ($amp_context
->isAmpRoute() && $view_mode == 'full') {
$view_mode = 'amp';
}
}