You are here

function consumers_update_8102 in Consumers 8

Add field 'third_party' using the entity system.

File

./consumers.install, line 34
Install, update and uninstall functions for Consumers.

Code

function consumers_update_8102() {
  $field_definition = BaseFieldDefinition::create('boolean')
    ->setLabel(new TranslatableMarkup('Is this consumer 3rd party?'))
    ->setDescription(new TranslatableMarkup('Mark this if the organization behind this consumer is not the same as the one behind the Drupal API.'))
    ->setDisplayOptions('view', [
    'label' => 'inline',
    'type' => 'boolean',
    'weight' => 4,
  ])
    ->setDisplayOptions('form', [
    'weight' => 4,
  ])
    ->setRevisionable(TRUE)
    ->setTranslatable(TRUE)
    ->setDefaultValue(TRUE)
    ->setInitialValue(TRUE);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('third_party', 'consumer', 'consumers', $field_definition);
}