/**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     ctools_include('export');
     $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier());
     if ($object) {
         ctools_export_crud_delete($this->getComponent(), $object);
     }
     $data = $this->getData();
     $data->export_type = NULL;
     // get title_pane key if configured.
     if (isset($data->conf['display']->title_pane)) {
         $title_pane = $data->conf['display']->title_pane;
     }
     $display = panels_save_display($data->conf['display']);
     // title_pane configuration workaround.
     if (isset($display->content[$title_pane])) {
         $pid = $display->content[$title_pane]->pid;
         $display->{$title_pane} = $pid;
         db_update('panels_display')->fields(array('title_pane' => $pid))->condition('did', $display->did)->execute();
     }
     $data->conf['did'] = $data->conf['display']->did;
     unset($data->conf['display']);
     ctools_export_crud_save($this->getComponent(), $data);
     $settings->addInfo('imported', $this->getUniqueId());
 }
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     ctools_include('export');
     $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier());
     if ($object) {
         ctools_export_crud_delete($this->getComponent(), $object);
     }
     $data = $this->getData();
     $data->export_type = NULL;
     $group = field_group_unpack($data);
     ctools_export_crud_save($this->getComponent(), $group);
     $settings->addInfo('imported', $this->getUniqueId());
 }
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     ctools_include('export');
     $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier());
     if ($object) {
         ctools_export_crud_delete($this->getComponent(), $object);
     }
     $data = $this->getData();
     $data->export_type = NULL;
     panels_save_display($data->conf['display']);
     $data->conf['did'] = $data->conf['display']->did;
     unset($data->conf['display']);
     ctools_export_crud_save($this->getComponent(), $data);
     $settings->addInfo('imported', $this->getUniqueId());
 }
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     filter_format_save($this->getData());
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 5
0
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     $info = (object) $this->getData();
     $info->base = 'node_content';
     $info->module = 'node';
     $info->custom = 1;
     $info->modified = 1;
     $info->locked = 0;
     node_type_save($info);
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 6
0
 /**
  * Print the configuration as plain text formatted to use in a tar file.
  *
  * @param  ConfigIteratorSettings $settings
  * @see iterate()
  */
 protected function printRaw(ConfigIteratorSettings &$settings)
 {
     $this->build();
     $this->buildHash();
     $settings->addInfo('hash', $this->getHash());
     $file_name = $this->storage->getFileName();
     $settings->addInfo('exported', $this->getUniqueId());
     foreach ($this->getRequiredModules() as $module => $status) {
         $settings->addInfo('modules', $module);
     }
     $settings->addInfo('exported_files', $file_name);
     if ($settings->getSetting('format') == 'tar') {
         $file_content = $this->raw();
         print ConfigurationManagement::createTarContent($settings->getSetting('tar_folder') . "/{$file_name}", $file_content);
     } else {
         $print = $settings->getSetting('print');
         if (is_array($print)) {
             if (!empty($print['dependencies'])) {
                 foreach (array_keys($this->getDependencies()) as $line) {
                     print '  "' . $line . '": "' . $line . "\",\n";
                 }
             }
             if (!empty($print['optionals'])) {
                 foreach (array_keys($this->getOptionalConfigurations()) as $line) {
                     print '  "' . $line . '": "' . $line . "\",\n";
                 }
             }
         }
     }
 }
Esempio n. 7
0
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     $role = $this->getData();
     if (!empty($role->machine_name) && ($existing = db_query("SELECT rid FROM {role} WHERE machine_name = :machine_name", array(':machine_name' => $role->machine_name))->fetchField())) {
         $role->rid = $existing;
     }
     user_role_save($role);
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 8
0
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     $entity = $this->getData();
     $entity_type = $this->getComponent();
     if ($original = entity_load_single($entity_type, $this->getIdentifier())) {
         $entity->id = $original->id;
         unset($entity->is_new);
     }
     $entity->save();
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 9
0
 /**
  * Overrides Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     $variable = $this->getData();
     variable_set($variable['name'], $variable['content']);
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 10
0
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     $style = $this->getData();
     // Does an image style with the same name already exist?
     if ($existing_style = image_style_load($this->getIdentifier())) {
         $isExistingEditable = (bool) ($existing_style['storage'] & IMAGE_STORAGE_EDITABLE);
         $isNewEditable = (bool) ($style['storage'] & IMAGE_STORAGE_EDITABLE);
         // New style is using defaults -> revert existing.
         if (!$isNewEditable && $isExistingEditable) {
             image_default_style_revert($this->getIdentifier());
         } elseif ($isExistingEditable && $isNewEditable) {
             $style['isid'] = $existing_style['isid'];
             $style = image_style_save($style);
             if (!empty($existing_style['effects'])) {
                 foreach ($existing_style['effects'] as $effect) {
                     image_effect_delete($effect);
                 }
             }
             if (!empty($style['effects'])) {
                 foreach ($style['effects'] as $effect) {
                     $effect['isid'] = $style['isid'];
                     image_effect_save($effect);
                 }
             }
         } elseif ($isNewEditable && !$isExistingEditable) {
             if (!empty($existing_style['isid'])) {
                 $style['isid'] = $existing_style['isid'];
             }
             $style = image_style_save($style);
             if (!empty($style['effects'])) {
                 foreach ($style['effects'] as $effect) {
                     $effect['isid'] = $style['isid'];
                     image_effect_save($effect);
                 }
             }
         } else {
         }
     } else {
         $style = image_style_save($style);
         if (!empty($style['effects'])) {
             foreach ($style['effects'] as $effect) {
                 $effect['isid'] = $style['isid'];
                 image_effect_save($effect);
             }
         }
         image_style_flush($style);
     }
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 11
0
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     field_info_cache_clear();
     // Load all the existing fields and instance up-front so that we don't
     // have to rebuild the cache all the time.
     $existing_fields = field_info_fields();
     $existing_instances = field_info_instances();
     $field = $this->getData();
     // Create or update field.
     $field_config = $field['field_config'];
     if (isset($existing_fields[$field_config['field_name']])) {
         $existing_field = $existing_fields[$field_config['field_name']];
         if ($field_config + $existing_field != $existing_field) {
             field_update_field($field_config);
         }
     } else {
         field_create_field($field_config);
         $existing_fields[$field_config['field_name']] = $field_config;
     }
     // Create or update field instance.
     $field_instance = $field['field_instance'];
     if (isset($existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']])) {
         $existing_instance = $existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']];
         if ($field_instance + $existing_instance != $existing_instance) {
             field_update_instance($field_instance);
         }
     } else {
         field_create_instance($field_instance);
         $existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']] = $field_instance;
     }
     variable_set('menu_rebuild_needed', TRUE);
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 12
0
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     node_types_rebuild();
     $exist = FALSE;
     $roles = static::get_roles();
     $permissions_by_role = static::get_permissions(FALSE);
     $map = user_permission_get_modules();
     $permission = $this->getData();
     $perm = $permission['permission'];
     foreach ($roles as $role) {
         if (isset($map[$perm])) {
             $exist = TRUE;
             if (in_array($role, $permission['roles'])) {
                 $permissions_by_role[$role][$perm] = TRUE;
             } else {
                 $permissions_by_role[$role][$perm] = FALSE;
             }
         }
     }
     if (!$exist) {
         drupal_set_message(t('Configuration Management: Permission %permission does not exist and can not be set.', array('%permission' => $perm)), 'error');
     }
     // Write the updated permissions.
     foreach ($roles as $rid => $role) {
         if (isset($permissions_by_role[$role])) {
             user_role_change_permissions($rid, $permissions_by_role[$role]);
         }
     }
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 13
0
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     $profile = $this->getData();
     // For profiles that doens't have editors assigned, provide a default
     // object to avoid sql exceptions.
     if (empty($profile)) {
         $profile = new \StdClass();
         $profile->editor = '';
         $profile->format = $this->getIdentifier();
         $profile->settings = array();
     }
     db_merge('wysiwyg')->key(array('format' => $profile->format))->fields(array('format' => $profile->format, 'editor' => $profile->editor, 'settings' => serialize($profile->settings)))->execute();
     wysiwyg_profile_cache_clear();
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 14
0
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     $vocabulary = (object) $this->getData();
     if (!empty($vocabulary->vid)) {
         unset($vocabulary->vid);
     }
     $existing = taxonomy_get_vocabularies();
     foreach ($existing as $existing_vocab) {
         if ($existing_vocab->machine_name === $vocabulary->machine_name) {
             $vocabulary->vid = $existing_vocab->vid;
             break;
         }
     }
     taxonomy_vocabulary_save($vocabulary);
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 15
0
 /**
  * Overrides Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     $data = $this->getData();
     // Determine if the menu already exists.
     $data['mlid'] = static::getMenuLinkByIdenfifier($this->getIdentifier());
     if (!empty($data['parent_identifier'])) {
         $data['plid'] = static::getMenuLinkByIdenfifier($this->data['parent_identifier'], TRUE);
     }
     menu_link_save($data);
     $settings->addInfo('imported', $this->getUniqueId());
 }
Esempio n. 16
0
 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     if ($style = image_style_load($this->getIdentifier())) {
         if (!empty($style['isid'])) {
             image_style_delete($style);
         }
     }
     image_default_style_save($this->getData());
     $settings->addInfo('imported', $this->getUniqueId());
 }