Merge branch 'feature/wizard-step-logging-configuration-6129'
This commit is contained in:
commit
5da5dde602
|
@ -30,7 +30,7 @@
|
|||
|
||||
namespace Icinga\Form\Config;
|
||||
|
||||
use Zend_Config;
|
||||
use \Zend_Config;
|
||||
use Icinga\Web\Form;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Web\Form\Validator\WritablePathValidator;
|
||||
|
@ -116,7 +116,19 @@ class LoggingForm extends Form
|
|||
'required' => true,
|
||||
'label' => t('Application Prefix'),
|
||||
'helptext' => t('The name of the application by which to prefix syslog messages.'),
|
||||
'value' => $loggingConfig->get('application', 'icingaweb')
|
||||
'value' => $loggingConfig->get('application', 'icingaweb'),
|
||||
'validators' => array(
|
||||
array(
|
||||
'Regex',
|
||||
false,
|
||||
array(
|
||||
'pattern' => '/^[^\W]+$/',
|
||||
'messages' => array(
|
||||
'regexNotMatch' => 'The application prefix cannot contain any whitespaces.'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->addElement(
|
||||
|
@ -151,6 +163,16 @@ class LoggingForm extends Form
|
|||
$this->setSubmitLabel('{{SAVE_ICON}} Save Changes');
|
||||
}
|
||||
|
||||
public function isValid($data) {
|
||||
foreach ($this->getElements() as $key => $element) {
|
||||
// Initialize all empty elements with their default values.
|
||||
if (!isset($data[$key])) {
|
||||
$data[$key] = $element->getValue();
|
||||
}
|
||||
}
|
||||
return parent::isValid($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Zend_Config object containing the state defined in this form
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue