You are here

function cms_content_sync_update_8011 in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x cms_content_sync.install \cms_content_sync_update_8011()
  2. 2.0.x cms_content_sync.install \cms_content_sync_update_8011()

Unset parent_id handler for paragraphs as it's using a local ID and we re-set it later anyway.

File

./cms_content_sync.install, line 294
Install file for cms_content_sync.

Code

function cms_content_sync_update_8011() {
  foreach (Flow::getAll(FALSE) as $flow) {
    $changed = FALSE;
    foreach ($flow->sync_entities as $key => &$config) {
      if (substr_count($key, '-') !== 2) {
        continue;
      }
      list($entity_type, , $field_name) = explode('-', $key);
      if ($entity_type === 'paragraph' && $field_name === 'parent_id' && isset($config['handler']) && $config['handler'] !== 'ignore') {
        $config['handler'] = 'ignore';
        $config['export'] = 'disabled';
        $config['import'] = 'disabled';
        $changed = TRUE;
      }
    }
    if ($changed) {
      $flow
        ->save();
    }
  }
  return 'Removed parent_id property for paragraphs from all Flows. Please re-export your Flows.';
}