/** * Implements Drupal\configuration\Config\Configuration::saveToActiveStore(). */ public function saveToActiveStore(ConfigIteratorSettings &$settings) { filter_format_save($this->getData()); $settings->addInfo('imported', $this->getUniqueId()); }
/** * @Given I setup Pathologic local paths * * Save Pathologic settings for testing. */ public function pathologic_save() { $cu_path = 'testing'; $cu_sid = 'p1eb825ce549'; $pathologic_string = "/{$cu_sid}\r\n" . "/{$cu_path}\r\n" . "http://www.colorado.edu/{$cu_sid}\r\n" . "http://www.colorado.edu/{$cu_path}\r\n" . "https://www.colorado.edu/{$cu_sid}\r\n" . "https://www.colorado.edu/{$cu_path}"; $format = filter_format_load("wysiwyg"); if (empty($format->filters)) { // Get the filters used by this format. $filters = filter_list_format($format->format); // Build the $format->filters array... $format->filters = array(); foreach ($filters as $name => $filter) { foreach ($filter as $k => $v) { $format->filters[$name][$k] = $v; } } } $format->filters["pathologic"]["settings"]["local_paths"] = $pathologic_string; filter_format_save($format); }
/** * {@inheritDoc} */ public function synchronize(NodeInterface $node, Context $context, $dirtyAllowed = false) { $object = ['name' => $this->getFormatName($node, $context), 'format' => $node->getName()]; // Handle permissions as well. $filters = []; $weight = 0; if ($node->hasChild('filters')) { $valid = array_keys(module_invoke_all('filter_info')); foreach ($node->getChild('filters')->getChildren() as $filter) { $name = $filter->getName(); if (!in_array($name, $valid)) { $context->logWarning(sprintf("%s: filter does not exists, ignoring", $filter->getPath())); continue; } $filterValue = $filter->getValue(); if (true === $filterValue || empty($filterValue)) { $filterValue = []; } if (!isset($filterValue['weight'])) { $filterValue['weight'] = $weight; } $filters[$name] = $filterValue; $filters[$name]['status'] = 1; ++$weight; } } $object['filters'] = $filters; $format = (object) $object; filter_format_save($format); }
/** * Normalize and save format objects. * * @param object $format * Text format object to be sanitized and saved. * * @return bool|int * SAVED_UPDATED if saved, FALSE otherwise. */ private function saveTextFormat($format) { foreach ($format->filters as $key => $value) { $format->filters[$key] = (array) $value; } return filter_format_save($format); }