function entity_print_install in Entity Print 8.2
Same name and namespace in other branches
- 8 entity_print.install \entity_print_install()
Implements hook_install().
1 call to entity_print_install()
- EntityPrintAdminTest::testViewPdfLink in tests/
src/ Functional/ EntityPrintAdminTest.php - Test the view PDF extra field and the configurable text.
File
- ./
entity_print.install, line 14 - Entity Print installation file.
Code
function entity_print_install() {
$entity_type_manager = \Drupal::entityTypeManager();
$storage = $entity_type_manager
->getStorage('entity_view_mode');
// Add a PDF view mode if the node entity type exists and the PDF view mode
// does not already exist.
if ($entity_type_manager
->getDefinition('node', FALSE) && !$storage
->load('node.pdf')) {
$storage
->create([
'targetEntityType' => 'node',
'id' => 'node.pdf',
'status' => TRUE,
'label' => t('PDF'),
])
->save();
}
}