isValidAuthenticationBackend() ) { $this->addForceCreationCheckbox(); return false; } return true; } /** * Validate the configuration state of this backend with the concrete authentication backend. * * An implementation should not throw any exception, but use the add/setErrorMessages method * of Zend_Form. If the 'force_creation' checkbox is set, this method won't be called. * * @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']); 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); } /** * Add a checkbox to be displayed at the beginning of the form * which allows the user to skip the connection validation */ protected function addForceCreationCheckbox() { $this->addElement( 'checkbox', 'force_creation', array( 'order' => 0, 'ignore' => true, 'label' => t('Force Changes'), 'helptext' => t('Check this box to enforce changes without connectivity validation') ) ); } }