mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
lib: Automatically flatten subform values in ConfigForm::getValues()
Zend returns values from subforms grouped by their names and we have several places where we manually extract them. ConfigForm::getValues() does this automatically now.
This commit is contained in:
parent
64bed9867f
commit
395201eee9
@ -5,9 +5,9 @@ namespace Icinga\Forms;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Zend_Form_Decorator_Abstract;
|
use Zend_Form_Decorator_Abstract;
|
||||||
|
use Icinga\Application\Config;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use Icinga\Web\Notification;
|
use Icinga\Web\Notification;
|
||||||
use Icinga\Application\Config;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form base-class providing standard functionality for configuration forms
|
* Form base-class providing standard functionality for configuration forms
|
||||||
@ -21,6 +21,23 @@ class ConfigForm extends Form
|
|||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* Values from subforms are directly added to the returned values array instead of being grouped by the subforms'
|
||||||
|
* names.
|
||||||
|
*/
|
||||||
|
public function getValues($suppressArrayNotation = false)
|
||||||
|
{
|
||||||
|
$values = parent::getValues($suppressArrayNotation);
|
||||||
|
foreach (array_keys($this->_subForms) as $name) {
|
||||||
|
// Zend returns values from subforms grouped by their names, but we want them flat
|
||||||
|
$values = array_merge($values, $values[$name]);
|
||||||
|
unset($values[$name]);
|
||||||
|
}
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the configuration to use when populating the form or when saving the user's input
|
* Set the configuration to use when populating the form or when saving the user's input
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user