function custom_pub_update_8091 in Custom Publishing Options 8
Function to add public options under the promotion options.
File
- ./
custom_pub.install, line 23 - Install and update function for Custom Publishing Options.
Code
function custom_pub_update_8091() {
\Drupal::entityTypeManager()
->clearCachedDefinitions();
$update_manager = Drupal::service('entity.definition_update_manager');
$promotion_options = BaseFieldDefinition::create('boolean')
->setLabel(t('Publish under Promotion options'))
->setDescription(t('Under Promotion options'))
->setDefaultValue(FALSE)
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'boolean',
'weight' => 5,
])
->setDisplayOptions('form', [
'type' => 'boolean_checkbox',
'weight' => 5,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$update_manager
->installFieldStorageDefinition('publish_under_promote_options', 'custom_publishing_option', 'custom_pub', $promotion_options);
}