Skip to content

Commit

Permalink
Remove getConfig and add get/setBackendConfig instead
Browse files Browse the repository at this point in the history
As for every configuration form, backend forms need special population
mechanisms as well.

refs #5525
  • Loading branch information
Johannes Meyer committed Jul 24, 2014
1 parent 4fe46a2 commit 235c4a8
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions application/forms/Config/Authentication/BaseBackendForm.php
Expand Up @@ -55,14 +55,6 @@ public function isValid($data)
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.
*
Expand All @@ -72,4 +64,34 @@ abstract public function getConfig();
* @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);
}
}

0 comments on commit 235c4a8

Please sign in to comment.