You are here

function opigno_moxtra_update_8008 in Opigno Moxtra 8

Creates the live meeting calendar event type.

File

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

Code

function opigno_moxtra_update_8008() {
  $config_path = drupal_get_path('module', 'opigno_moxtra') . '/config/install';
  $storage = new FileStorage($config_path);
  $config_storage = \Drupal::service('config.storage');
  $data = $storage
    ->read('opigno_calendar_event.type.meeting_calendar_event');
  $config_storage
    ->write('opigno_calendar_event.type.meeting_calendar_event', $data);
  $data = $storage
    ->read('field.storage.opigno_calendar_event.field_meeting');
  if (!FieldStorageConfig::loadByName($data['entity_type'], $data['field_name'])) {
    FieldStorageConfig::create($data)
      ->save();
  }
  $data = $storage
    ->read('field.field.opigno_calendar_event.meeting_calendar_event.field_meeting');
  if (!FieldConfig::loadByName($data['entity_type'], $data['bundle'], $data['field_name'])) {
    FieldConfig::create($data)
      ->save();
  }
  $data = $storage
    ->read('field.field.opigno_calendar_event.meeting_calendar_event.field_calendar_event_members');
  if (!FieldConfig::loadByName($data['entity_type'], $data['bundle'], $data['field_name'])) {
    FieldConfig::create($data)
      ->save();
  }
}