/** * Overrides Drupal\configuration\Config\Configuration::alterDependencies(). */ public static function alterDependencies(Configuration $config) { static $cache; if (!isset($cache)) { $cache = array(); } // Dependencies for Page Manager Handlers. if ($config->getComponent() == 'page_manager_handlers' && !$config->broken) { // This line seems to be inconsistent when executed from drush or browser. $config_data = $config->getData(); // This alternative works more consistent althoug it's no so pretty. if (!isset($config_data->conf['display'])) { if (!isset($cache[$config->getUniqueId()])) { @eval(ctools_export_crud_export($config->getComponent(), $config_data)); $cache[$config->getUniqueId()] = $handler; } else { $handler = $cache[$config->getUniqueId()]; } $config_data = $handler; } foreach ($config_data->conf['display']->content as $object) { $type = $object->type; switch ($type) { case 'block': list($subtype, $id, ) = explode('-', $object->subtype); switch ($subtype) { // Display block from a view. case 'views': $config_id = 'views_view.' . $id; $view = ConfigurationManagement::createConfigurationInstance($config_id); $view->build(); $config->addToDependencies($view); $config->addToDependencies($view); break; } break; // A view added directly. // A view added directly. case 'views': $config_id = 'views_view.' . $object->subtype; $view = ConfigurationManagement::createConfigurationInstance($config_id); $view->build(); $config->addToDependencies($view); break; // A view added using the Views content panes module. // A view added using the Views content panes module. case 'views_panes': list($subtype, ) = explode('-', $object->subtype); $config_id = 'views_view.' . $subtype; $view = ConfigurationManagement::createConfigurationInstance($config_id); $view->build(); $config->addToDependencies($view); break; } } } }
/** * Saves the configuration object into the DataStore. */ public function getDataToSave() { $filename = $this->filename; ctools_include('export'); $export = '$api = ' . $this->export($this->api_version) . ";\n\n"; $export .= '$data = ' . ctools_export_crud_export($this->table, $this->data) . "\n\n"; $export .= '$dependencies = ' . $this->export($this->dependencies) . ";\n\n"; $export .= '$optional = ' . $this->export($this->optional_configurations) . ";\n\n"; $export .= '$modules = ' . $this->export($this->required_modules) . ";"; $file_contents = "<?php\n/**\n * @file\n * {$filename}\n */\n\n" . $export . "\n"; $this->hash = sha1($file_contents); return $file_contents; }
/** * Page callback to display export information for an exportable item. */ function export_page($js, $input, $item) { drupal_set_title($this->get_page_title('export', $item), PASS_THROUGH); return drupal_get_form('ctools_export_form', ctools_export_crud_export($this->plugin['schema'], $item), t('Export')); }