/** * Add customer last name field * * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset * @return Mage_XmlConnect_Block_Customer_Address_Form */ protected function _addLastName(Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $contactInfoFieldset) { $lastName = $this->getAddress()->getLastname(); $contactInfoFieldset->addField('lastname', 'text', array('label' => $this->__('Last Name'), 'required' => 'true', 'value' => isset($lastName) ? $lastName : '')); return $this; }
/** * Add password fields * * Add to form current password, password and password confirmation fields * * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $formFieldset * @return Mage_XmlConnect_Block_Customer_Form */ protected function _addPasswordFields(Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $formFieldset) { /** * Return password confirmation validator in old format */ if ($this->getIsEditPage()) { $formFieldset->addField('current_password', 'password', array('label' => $this->__('Current Password'), 'required' => 'true')); } $formFieldset->addField('password', 'password', array('label' => $this->getPasswordLabel()) + $this->_getRequiredParam()); $field = $formFieldset->addField('confirmation', 'password', array('label' => $this->getConfirmLabel()) + $this->_getRequiredParam())->addValidator(); $field->getXmlObject()->addCustomChild('validator', 'password', array('type' => 'confirmation', 'message' => $this->__('Regular and confirmation passwords must be equal'))); return $this; }
/** * Add rule element to validator container * * @param array $config * @param boolean $after * @return Mage_XmlConnect_Model_Simplexml_Form_Element_Abstract */ public function addRule(array $config, $after = false) { if (isset($config['type'])) { $ruleType = $config['type']; } $elementId = $this->getXmlId() . '_' . $ruleType; $element = parent::addField($elementId, $this->getRuleTypeBlock(), $config, $after); if ($renderer = Mage_XmlConnect_Model_Simplexml_Form::getValidatorRuleRenderer()) { $element->setRenderer($renderer); } return $element; }
/** * Add customer info to xml object * * @param Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset * @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard */ protected function _addCustomers(Mage_XmlConnect_Model_Simplexml_Form_Element_Fieldset $overallActivityFieldset) { $customersField = $overallActivityFieldset->addField('customers', 'custom', array('label' => $this->__('Customers'))); $this->getChild('customers')->addCustomersToXmlObj($customersField->getXmlObject()); return $this; }