function block_content_update_8600 in Drupal 8
Add 'reusable' field to 'block_content' entities.
File
- core/
modules/ block_content/ block_content.install, line 129 - Install, update and uninstall functions for the block_content module.
Code
function block_content_update_8600() {
$reusable = BaseFieldDefinition::create('boolean')
->setLabel(t('Reusable'))
->setDescription(t('A boolean indicating whether this block is reusable.'))
->setTranslatable(FALSE)
->setRevisionable(FALSE)
->setDefaultValue(TRUE)
->setInitialValue(TRUE);
\Drupal::entityDefinitionUpdateManager()
->installFieldStorageDefinition('reusable', 'block_content', 'block_content', $reusable);
}