/** * {@inheritdoc} */ public function asConfig() { $config = ConfigHelper::toArray(get_object_vars($this)); if (!$this->forceLookahead) { unset($config['forceLookahead']); } if (isset($config['predefinedAttributes'])) { $config['predefinedAttributes'] = new Dictionary($config['predefinedAttributes']); } return $config; }
/** * @return array|null This plugin's config, or NULL to disable this plugin */ public function asConfig() { $properties = get_object_vars($this); unset($properties['configurator']); return ConfigHelper::toArray($properties); }
public function asConfig() { return ConfigHelper::toArray(\get_object_vars($this)); }
/** * {@inheritdoc} */ public function asConfig() { $vars = get_object_vars($this); unset($vars['markedSafe']); return ConfigHelper::toArray($vars); }
/** * @return mixed */ public function asConfig() { return ConfigHelper::toArray($this->items, true); }
/** * {@inheritdoc} */ public function asConfig() { $config = ['callback' => $this->callback]; foreach ($this->params as $k => $v) { if (is_numeric($k)) { // By value $config['params'][] = $v; } elseif (isset($this->vars[$k])) { // By name, but the value is readily available in $this->vars $config['params'][] = $this->vars[$k]; } else { // By name $config['params'][$k] = null; } } if (isset($config['params'])) { $config['params'] = ConfigHelper::toArray($config['params'], true, true); } // Add the callback's JavaScript representation $config['js'] = new Variant(); $config['js']->set('JS', $this->js); return $config; }
/** * {@inheritdoc} */ public function asConfig() { $vars = get_object_vars($this); // Remove properties that are not needed during parsing unset($vars['defaultChildRule']); unset($vars['defaultDescendantRule']); unset($vars['template']); // If there are no attribute preprocessors defined, we can remove the step from this tag's // filterChain if (!count($this->attributePreprocessors)) { $callback = 's9e\\TextFormatter\\Parser::executeAttributePreprocessors'; // We operate on a copy of the filterChain, without modifying the original $filterChain = clone $vars['filterChain']; // Process the chain in reverse order so that we don't skip indices $i = count($filterChain); while (--$i >= 0) { if ($filterChain[$i]->getCallback() === $callback) { unset($filterChain[$i]); } } $vars['filterChain'] = $filterChain; } return ConfigHelper::toArray($vars); }
/** * Generate and return the complete config array * * @return array */ public function asConfig() { // Finalize the plugins' config $this->plugins->finalize(); // Remove properties that shouldn't be turned into config arrays $properties = get_object_vars($this); unset($properties['attributeFilters']); unset($properties['bundleGenerator']); unset($properties['javascript']); unset($properties['rendering']); unset($properties['rulesGenerator']); unset($properties['registeredVars']); unset($properties['templateChecker']); unset($properties['templateNormalizer']); unset($properties['stylesheet']); // Create the config array $config = ConfigHelper::toArray($properties); $bitfields = RulesHelper::getBitfields($this->tags, $this->rootRules); // Save the root context $config['rootContext'] = $bitfields['root']; $config['rootContext']['flags'] = $config['rootRules']['flags']; // Save the registered vars (including the empty ones) $config['registeredVars'] = ConfigHelper::toArray($this->registeredVars, true); // Make sure those keys exist even if they're empty $config += ['plugins' => [], 'tags' => []]; // Remove unused tags $config['tags'] = array_intersect_key($config['tags'], $bitfields['tags']); // Add the bitfield information to each tag foreach ($bitfields['tags'] as $tagName => $tagBitfields) { $config['tags'][$tagName] += $tagBitfields; } // Remove unused entries unset($config['rootRules']); return $config; }