/** * @param string $label * The label of the element * @param Customweb_Form_Control_IControl $control * The control of the element. * @param string $description * [optional] The description of the elment. * @param boolean $globalScope * [optional] Can the value be set per store? * @param boolean $inherited * [optional] Are values inherited? */ public function __construct(Customweb_Form_Control_IControl $control, $description = '', $globalScope = true, $inherited = false) { $this->control = $control; $this->elementId = $control->getControlId() . '-element'; $this->description = $description; $this->intention = Customweb_Form_Intention_Factory::getNullIntention(); if (!$control instanceof Customweb_Form_Control_IEditableControl) { $this->globalScope = false; } else { $this->globalScope = (bool) $globalScope; } $this->inherited = (bool) $inherited; }
protected function buildBicElement() { if ($this->getBicFieldName() !== null) { if ($this->getBicOptionList() !== null) { $list = $this->getBicOptionList(); asort($list); $this->bicControl = new Customweb_Form_Control_Select($this->getBicFieldName(), array_merge(array('none' => ' - ' . Customweb_I18n_Translation::__('Please select') . ' - '), $list)); $description = Customweb_I18n_Translation::__('Please select the Bank Identifier Code (BIC) of your bank.'); } else { $this->bicControl = new Customweb_Form_Control_TextInput($this->getBicFieldName()); $description = Customweb_I18n_Translation::__('Please enter here the Bank Identifier Code (BIC).'); $this->bicControl->setAutocomplete(false); } $this->bicControl->addValidator(new Customweb_Form_Validator_NotEmpty($this->bicControl, Customweb_I18n_Translation::__("You have to enter the BIC."))); $this->bicElement = new Customweb_Form_Element(Customweb_I18n_Translation::__('BIC'), $this->bicControl, $description); $this->bicElement->setElementIntention(Customweb_Form_Intention_Factory::getBankCodeIntention())->setErrorMessage($this->getBicErrorMessage()); } }
/** * This method returns the control id or an empty string. * * @param Customweb_Form_Control_IControl $control * @return string */ protected static function getControlId($control) { if ($control === null) { return ''; } else { return $control->getControlId(); } }
/** * @param Customweb_Form_Control_IControl $control * The control of the element. */ public function __construct(Customweb_Form_Control_IControl $control) { $this->control = $control; $this->elementId = $control->getControlId() . '-element'; $this->intention = Customweb_Form_Intention_Factory::getNullIntention(); }
public function renderOptionPrefix(Customweb_Form_Control_IControl $control, $optionKey) { return '<div class="' . $this->getCssClassPrefix() . $this->getOptionCssClass() . '" id="' . $control->getControlId() . '-' . $optionKey . '-key">'; }
public function renderControlPrefix(Customweb_Form_Control_IControl $control, $controlTypeClass) { $classes = $this->getCssClassPrefix() . $this->getControlCssClass() . ' ' . $this->getCssClassPrefix() . $controlTypeClass; if ($control instanceof Customweb_Form_Control_SingleCheckbox || $control instanceof Customweb_Form_Control_MultiCheckbox || $control instanceof Customweb_Form_Control_Radio) { $classes .= ' control'; } return '<div class="' . $classes . '" id="' . $control->getControlId() . '-wrapper">'; }