/** * This method generates the card number elements and controls. * * @return void */ protected function buildCardNumberElement() { $this->createLeadingHtmlControl(); $this->createCardNumberControl(); $this->createBrandSelectionControl(); // Combine the different controls into one control $controls = array(); // TODO: Leading HTML: How to handle this? (in case no card number should be added? if ($this->brandDropDownControl !== null) { $controls[] = $this->brandDropDownControl; } $controls[] = $this->cardNumberControl; if ($this->brandImageControl !== null) { $controls[] = $this->brandImageControl; } $control = new Customweb_Form_Control_MultiControl("card_number_multi_control", $controls); $this->cardNumberElement = new Customweb_Form_Element(Customweb_I18n_Translation::__('Card Number'), $control, Customweb_I18n_Translation::__('Please enter here the number on your card.')); $this->cardNumberElement->setElementIntention(Customweb_Form_Intention_Factory::getCardNumberIntention())->setErrorMessage($this->getCardNumberElementErrorMessage()); }
/** * This method creates a card number form element. * The $fieldName is the * name of the input field. If $alias is set not a input field is shown, * instead a HTML field is shown with the alias. * * @param string $fieldName * @param string $alias * @deprecated Use instead the Customweb_Payment_Authorization_Method_CreditCard_ElementBuilder * @return Customweb_Form_IElement */ public static function getCardNumberElement($fieldName, $alias = '', $errorMessage = null, $defaultCard = null) { $control = null; if (empty($alias)) { $control = new Customweb_Form_Control_TextInput($fieldName, $defaultCard); $control->addValidator(new Customweb_Form_Validator_NotEmpty($control, Customweb_I18n_Translation::__("You have to enter a card number."))); $control->setAutocomplete(false); } else { $control = new Customweb_Form_Control_Html($fieldName, $alias); } $element = new Customweb_Form_Element(Customweb_I18n_Translation::__('Card Number'), $control, Customweb_I18n_Translation::__('Please enter here the number on your card.')); $element->setElementIntention(Customweb_Form_Intention_Factory::getCardNumberIntention())->setErrorMessage($errorMessage); return $element; }