'Same as Billing Address' * 'value' => 'billing', * ] * @array */ protected $_sameAs; protected $_hasPersonName = false; protected function _initElements() { $this->_dfRelations = []; if ($this->getSameAs()) { $this->_dfRelations = [ [ 'element' => 'sameAs', 'rules' => [ [ 'value' => '', 'elements' => ['address', 'address2', 'city', 'state', 'zip'], ], ], ], ]; $this->addElement('checkbox', 'sameAs', [ 'label' => $this->getSameAs('label'), 'checkedValue' => $this->getSameAs('value'), 'decoration' => 'simple', 'unCheckedValue' => '', ]); } if ($this->hasPersonName()) { $this->addElement('text', 'firstName', ['label' => 'First Name', 'required' => true, 'maxlength' => 255]); $this->addElement('text', 'lastName', ['label' => 'Last Name', 'required' => true, 'maxlength' => 255]); } $this->addElement('text', 'address', [ 'label' => 'Address', 'required' => $this->isElementRequired('address'), 'maxlength' => 255, ]); $this->addElement('text', 'address2', ['label' => 'Address 2', 'maxlength' => 255]); $this->addElement('text', 'city', [ 'label' => 'City', 'required' => $this->isElementRequired('address'), 'maxlength' => 255, ]); $this->addElement('select', 'state', [ 'label' => 'State', 'required' => $this->isElementRequired('address'), 'multiOptions' => ['' => 'Select One'] + (array) (new Qs_Db_Table('DState'))->get4Select(), ]); $this->addElement('zip', 'zip', [ 'label' => 'Zip', 'required' => $this->isElementRequired('address'), 'maxlength' => 10, ]); return $this; } public function getSameAs($field = null, $default = null) { return Qs_Array::get($this->_sameAs, $field, $default); } public function setSameAs(array $_sameAs) { $this->_sameAs = $_sameAs; return $this; } public function hasPersonName() { return $this->_hasPersonName; } public function setHasPersonName($hasPersonName) { $this->_hasPersonName = $hasPersonName; return $this; } }