Remove getConfig and add get/setBackendConfig instead

As for every configuration form, backend forms need special population
mechanisms as well.

refs #5525
This commit is contained in:
Johannes Meyer 2014-07-24 08:47:58 +02:00
parent 4fe46a2c6e
commit 235c4a8c52
1 changed files with 30 additions and 8 deletions

View File

@ -55,14 +55,6 @@ abstract class BaseBackendForm extends Form
return true;
}
/**
* Return an array containing all sections defined by this form as the key and all settings
* as an key-value sub-array
*
* @return array
*/
abstract public function getConfig();
/**
* Validate the configuration state of this backend with the concrete authentication backend.
*
@ -72,4 +64,34 @@ abstract class BaseBackendForm extends Form
* @return bool Whether validation succeeded or not
*/
abstract public function isValidAuthenticationBackend();
/**
* Return the backend's configuration values and its name
*
* The first value is the name and the second one the values as array.
*
* @return array
*/
public function getBackendConfig()
{
$values = $this->getValues();
$name = $values['name'];
unset($values['name']);
unset($values['btn_submit']);
unset($values['force_creation']);
unset($values[$this->getTokenElementName()]);
return array($name, $values);
}
/**
* Populate the form with the given configuration values
*
* @param string $name The name of the backend
* @param array $config The configuration values
*/
public function setBackendConfig($name, array $config)
{
$config['name'] = $name;
$this->populate($config);
}
}