addElement( 'text', 'query', array('label' => 'Search', 'size' => 50, 'filters' => array(new Zend_Filter_StringTrim())) ); $this->_setQueryDescription(); return $this; } public function setOptions(array $options) { if (isset($options['filterFields'])) { $this->_filterFields = $options['filterFields']; unset($options['filterFields']); } if (isset($options['filterQueryDescriptionFormat'])) { $this->_filterQueryDescriptionFormat = $options['filterQueryDescriptionFormat']; unset($options['filterQueryDescriptionFormat']); } if (isset($options['descriptionPlaceholder'])) { $this->_descriptionPlaceholder = $options['descriptionPlaceholder']; unset($options['descriptionPlaceholder']); } return parent::setOptions($options); } protected function _setQueryDescription() { if (!empty($this->_filterFields)) { $description = $this->_filterQueryDescriptionFormat; if (false !== strpos($description, $this->_descriptionPlaceholder)) { $fields = '"' . Qs_Array::implodeLast('", "', '" or "', $this->_filterFields) . '"'; $description = str_replace($this->_descriptionPlaceholder, $fields, $this->_filterQueryDescriptionFormat); } $this->getElement('query')->setDescription($description); } return $this; } protected function _initButtons() { if (!$this->_hasButtons) { return $this; } $this->addElement( 'submit', 'btnSearch', array( 'label' => 'Search', 'ignore' => true, 'attribs' => array('class' => 'btn'), ) ); $this->addElement( 'submit', 'btnCancel', array( 'label' => 'Reset', 'ignore' => true, 'attribs' => array( 'class' => 'btn', 'onclick' => "document.location='" . constant('BASE_URL') . '/' . constant('CURRENT_PAGE') . "';", 'helper' => 'formInputButton', ) ) ); $this->addDisplayGroup(array('btnSearch', 'btnCancel'), 'submitGroup'); return $this; } }