function amp_entity_view_mode_alter in Accelerated Mobile Pages (AMP) 8.3
Same name and namespace in other branches
- 8 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 114 - Provides functionality for handling AMP.
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(NULL, $entity) && $view_mode == 'full') {
$view_mode = 'amp';
}
}