function webform_entity_print_install in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_entity_print/webform_entity_print.install \webform_entity_print_install()
Implements hook_install().
2 calls to webform_entity_print_install()
- WebformAdminConfigAdvancedForm::submitForm in src/
Form/ AdminConfig/ WebformAdminConfigAdvancedForm.php - Form submission handler.
- WebformCliService::drush_webform_repair in src/
Commands/ WebformCliService.php
File
- modules/
webform_entity_print/ webform_entity_print.install, line 11 - Installation information for the 'Webform Entity Print' module.
Code
function webform_entity_print_install() {
/** @var \Drupal\webform\WebformThirdPartySettingsManagerInterface $third_party_settings_manager */
$third_party_settings_manager = \Drupal::service('webform.third_party_settings_manager');
// Debug.
if ($third_party_settings_manager
->getThirdPartySetting('webform_entity_print', 'debug') === NULL) {
$third_party_settings_manager
->setThirdPartySetting('webform_entity_print', 'debug', FALSE);
}
// Template.
if ($third_party_settings_manager
->getThirdPartySetting('webform_entity_print', 'template') === NULL) {
$template = [
'header' => '<h1>[webform_submission:label]</h1>',
'footer' => '',
'css' => '/* Remove page margins and padding and rely on the PDF generator\'s default margins. */
body {
margin: 0;
}
.page {
padding: 0;
}',
];
$third_party_settings_manager
->setThirdPartySetting('webform_entity_print', 'template', $template);
}
// Export types. Only enabling PDF documents.
if ($third_party_settings_manager
->getThirdPartySetting('webform_entity_print', 'export_types') === NULL) {
$export_types = [
'pdf' => [
'enabled' => TRUE,
'link_text' => t('Download PDF'),
'link_attributes' => [
'class' => [
'button',
],
],
],
];
$third_party_settings_manager
->setThirdPartySetting('webform_entity_print', 'export_types', $export_types);
}
}