function printable_entity_view_mode_info_alter in Printer and PDF versions for Drupal 8+ 8
Same name and namespace in other branches
- 2.x printable.module \printable_entity_view_mode_info_alter()
Implements hook_entity_view_mode_alter().
File
- ./
printable.module, line 177 - Provides printer friendly content entities.
Code
function printable_entity_view_mode_info_alter(&$view_modes) {
$printable_manager = \Drupal::service('printable.entity_manager');
foreach ($printable_manager
->getPrintableEntities() as $entity_type => $entity_definition) {
// Add an additional view mode to this entity.
$view_modes[$entity_type]['printable'] = [
'id' => $entity_type . '.printable',
'targetEntityType' => $entity_type,
'label' => t('Printable'),
'custom_settings' => FALSE,
'cache' => TRUE,
];
}
}