You are here

function opigno_moxtra_update_8003 in Opigno Moxtra 8

Creates the members field in workspaces.

File

./opigno_moxtra.install, line 127
Install, update and uninstall functions for the Opigno Moxtra module.

Code

function opigno_moxtra_update_8003() {

  // Create a new field definition.
  $field = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Members'))
    ->setDescription(t('The members of the Workspace entity.'))
    ->setSetting('target_type', 'user')
    ->setSetting('handler', 'default')
    ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);

  // Install the new definition.
  $definition_manager = \Drupal::entityDefinitionUpdateManager();
  $definition_manager
    ->installFieldStorageDefinition('members', 'opigno_moxtra_workspace', 'opigno_moxtra_workspace', $field);
}