/**
  * 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());
 }
예제 #2
0
 /**
  * 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());
 }
 function delete_page($js, $input, $item)
 {
     $clone = clone $item;
     // Change the name into the title so the form shows the right value.
     // @todo file a bug against CTools to use admin title if available.
     $clone->name = $clone->title;
     $form_state = array('plugin' => $this->plugin, 'object' => &$this, 'ajax' => $js, 'item' => $clone, 'op' => $item->export_type & EXPORT_IN_CODE ? 'revert' : 'delete', 'rerender' => TRUE, 'no_redirect' => TRUE);
     $output = drupal_build_form('ctools_export_ui_delete_confirm_form', $form_state);
     if (!empty($form_state['executed'])) {
         ctools_export_crud_delete($this->plugin['schema'], $item);
         $export_key = $this->plugin['export']['key'];
         drupal_set_message(t($this->plugin['strings']['confirmation'][$form_state['op']]['success'], array('%title' => $item->title)));
         drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
     }
     return $output;
 }
 /**
  * Deletes exportable items from the database.
  */
 function delete_form_submit(&$form_state)
 {
     $item = $form_state['item'];
     ctools_export_crud_delete($this->plugin['schema'], $item);
     $export_key = $this->plugin['export']['key'];
     $message = str_replace('%title', check_plain($item->{$export_key}), $this->plugin['strings']['confirmation'][$form_state['op']]['success']);
     drupal_set_message($message);
 }
 /**
  * Page callback to delete an exportable item.
  */
 function delete_page($js, $input, $item)
 {
     $form_state = array('plugin' => $this->plugin, 'object' => &$this, 'ajax' => $js, 'item' => $item, 'op' => $item->export_type & EXPORT_IN_CODE ? 'revert' : 'delete', 'rerender' => TRUE, 'no_redirect' => TRUE);
     ctools_include('form');
     $output = ctools_build_form('ctools_export_ui_delete_confirm_form', $form_state);
     if (!empty($form_state['executed'])) {
         ctools_export_crud_delete($this->plugin['schema'], $item);
         $export_key = $this->plugin['export']['key'];
         $message = str_replace('%title', check_plain($item->{$export_key}), $this->plugin['strings']['confirmation'][$form_state['op']]['success']);
         drupal_set_message($message);
         drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
     }
     return $output;
 }
 /**
  * Page callback to delete an exportable item.
  */
 function delete_page($js, $input, $item)
 {
     $form_state = array('plugin' => $this->plugin, 'object' => &$this, 'ajax' => $js, 'item' => $item, 'op' => $item->export_type & EXPORT_IN_CODE ? 'revert' : 'delete', 'rerender' => TRUE, 'no_redirect' => TRUE);
     $output = drupal_build_form('ctools_export_ui_delete_confirm_form', $form_state);
     if (!empty($form_state['executed'])) {
         // Cleanup the stream config and stream from static caches.
         heartbeat_stream_config_reset($item);
         ctools_export_crud_delete($this->plugin['schema'], $item);
         $message = str_replace('%title', check_plain($item->{$this->plugin['export']['key']}), $this->plugin['strings']['confirmation'][$form_state['op']]['success']);
         drupal_set_message($message);
         // Cleanup the blocks that might be in use.
         db_delete('block')->condition('module', 'heartbeat')->condition('delta', $item->class)->execute();
         drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
     }
     return $output;
 }
 /**
  * Revert the bean type to code defaults.
  */
 public function revert()
 {
     ctools_include('export');
     ctools_export_crud_delete('bean_type', $this->type);
     bean_reset();
 }