/** * {@inheritdoc} */ protected function writeConfig(Config $config) { // TODO: Remove this once #11743 is fixed $section = $config->getSection('elasticsearch'); foreach ($section->toArray() as $key => $value) { if ($value === null) { unset($section->{$key}); } } parent::writeConfig($config); }
/** * {@inheritdoc} */ public function getValues($suppressArrayNotation = false) { $values = array_filter(parent::getValues($suppressArrayNotation)); if (isset($values['permissions'])) { $values['permissions'] = implode(', ', $values['permissions']); } $restrictions = array(); foreach ($this->providedRestrictions as $name => $spec) { if (isset($values[$name])) { // Translate filtered element names to restriction names $restrictions[$spec['name']] = $values[$name]; unset($values[$name]); } } $values = array_merge($values, $restrictions); return $values; }
/** * Add a submit button to this form and one to manually validate the configuration * * Calls parent::addSubmitButton() to add the submit button. * * @return $this */ public function addSubmitButton() { parent::addSubmitButton()->getElement('btn_submit')->setDecorators(array('ViewHelper')); $this->addElement('submit', 'resource_validation', array('ignore' => true, 'label' => $this->translate('Validate Configuration'), 'data-progress-label' => $this->translate('Validation In Progress'), 'decorators' => array('ViewHelper'))); $this->setAttrib('data-progress-element', 'resource-progress'); $this->addElement('note', 'resource-progress', array('decorators' => array('ViewHelper', array('Spinner', array('id' => 'resource-progress'))))); $this->addDisplayGroup(array('btn_submit', 'resource_validation', 'resource-progress'), 'submit_validation', array('decorators' => array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'control-group form-controls'))))); return $this; }
/** * {@inheritdoc} */ protected function writeConfig(Config $config) { parent::writeConfig($config); if ($this->secondaryConfig !== null) { $this->config = $this->secondaryConfig; // Causes the config being displayed to the user in case of an error parent::writeConfig($this->secondaryConfig); } }
/** * Retrieve all form element values * * @param bool $suppressArrayNotation Ignored * * @return array */ public function getValues($suppressArrayNotation = false) { $values = parent::getValues(); $values = array_merge($values, $values['backend_form']); unset($values['backend_form']); return $values; }
/** * Return whether the given values are valid * * @param array $formData The data to validate * * @return bool */ public function isValid($formData) { if (!parent::isValid($formData)) { return false; } if (($el = $this->getElement('skip_validation')) === null || false === $el->isChecked()) { $resourceConfig = ResourceFactory::getResourceConfig($this->getValue('resource')); if (!self::isValidIdoSchema($this, $resourceConfig) || !self::isValidIdoInstance($this, $resourceConfig)) { if ($el === null) { $this->addSkipValidationCheckbox(); } return false; } } return true; }
/** * {@inheritDoc} */ protected function writeConfig(Config $config) { parent::writeConfig($config); if ($this->updatedAppConfig !== null) { $this->updatedAppConfig->saveIni(); } }
/** * Add a submit button to this form and one to manually validate the configuration * * Calls parent::addSubmitButton() to add the submit button. * * @return $this */ public function addSubmitButton() { parent::addSubmitButton()->getElement('btn_submit')->setDecorators(array('ViewHelper')); $this->addElement('submit', 'backend_validation', array('ignore' => true, 'label' => $this->translate('Validate Configuration'), 'decorators' => array('ViewHelper'))); $this->addDisplayGroup(array('btn_submit', 'backend_validation'), 'submit_validation', array('decorators' => array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'control-group'))))); return $this; }
/** * Return whether the given values are valid * * @param array $formData The data to validate * * @return bool */ public function isValid($formData) { if (!parent::isValid($formData)) { return false; } $resourceConfig = ResourceFactory::getResourceConfig($this->getValue('resource')); if (!self::isValidIdoSchema($this, $resourceConfig) || !self::isValidIdoInstance($this, $resourceConfig)) { $this->addSkipValidationCheckbox(); return false; } return true; }