FilterHelper::form PHP Méthode

form() public méthode

public form ( $model, $fields = [] )
    function form($model, $fields = array())
    {
        $output = '<tr id="filters">';
        $output .= $this->Form->create($model, array('action' => 'index', 'id' => 'filters'));
        if (!empty($fields)) {
            $cakeVersion = substr(Configure::read('Cake.version'), 0, 3);
            if ($cakeVersion === '1.2') {
                $output .= $this->_form12($model, $fields);
            } else {
                if ($cakeVersion === '1.3') {
                    $output .= $this->_form13($model, $fields);
                }
            }
        }
        $output .= '<th>';
        $output .= $this->Form->button(__('Filter', true), array('type' => 'submit', 'name' => 'data[filter]'));
        $output .= $this->Form->button(__('Reset', true), array('type' => 'submit', 'name' => 'data[reset]'));
        $output .= '</th>';
        $output .= $this->Form->end();
        $output .= '</tr>';
        return $output;
    }

Usage Example

Exemple #1
0
 /**
  * @brief lazy way to create the admin index page headers
  *
  * @param array $filterOptions the filters to show
  * @param array $massActions the mass actions to show
  * @access public
  *
  * @return string the markup generated
  */
 public function adminIndexHead($filterOptions = array(), $massActions = null)
 {
     if (!class_exists('FilterHelper')) {
         App::uses('FilterHelper', 'Filter.View/Helper');
     }
     return sprintf('<div class="adminTopBar">%s%s</div><div class="filters">%s</div>', $this->adminPageHead(), $massActions, FilterHelper::form('Post', $filterOptions) . FilterHelper::clear($filterOptions));
 }
All Usage Examples Of FilterHelper::form