pate-1.0.0/pate.install
pate.install
<?php
/**
* @file
* Install/Update hooks for pate.
*/
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Add the new "Structure only" basefield to nodes.
*/
function pate_update_9001() {
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_type = $entity_definition_update_manager->getEntityType('node');
$storage_definition = BaseFieldDefinition::create('boolean')
->setLabel(t('Structure only'))
->setDescription(t('A flag indicating whether this template should be cloned using structure-only mode.'))
->setRevisionable(TRUE)
->setTranslatable(FALSE)
->setDefaultValue(FALSE)
->setDisplayConfigurable('form', FALSE)
->setDisplayConfigurable('view', FALSE);
\Drupal::entityDefinitionUpdateManager()->installFieldStorageDefinition(
'pate_structure_only',
$entity_type->id(),
'pate',
$storage_definition
);
}
