You are here

function workspaces_update_8802 in Drupal 8

Add the 'parent' field to the 'workspace' entity type.

File

core/modules/workspaces/workspaces.install, line 169
Contains install, update and uninstall functions for the Workspaces module.

Code

function workspaces_update_8802() {
  $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();

  // Install the new 'parent' field.
  $storage_definition = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Parent'))
    ->setDescription(t('The parent workspace.'))
    ->setSetting('target_type', 'workspace')
    ->setReadOnly(TRUE);
  $entity_definition_update_manager
    ->installFieldStorageDefinition('parent', 'workspace', 'workspaces', $storage_definition);
}