private function applyFilters()
    {
        // Manage filters
        // Filter values come either from the form (GET)
        // Or from session
        $form = $this->getFiltersForm();

        if (!$form) {
            // No filters are configured for this admin
            return;
        }

        $this->loadFilterValues();
        // Init form with current data if any
        $form->setData($this->filterValues);

        $form->handleRequest($this->request);

        if ($form->isSubmitted()) {

            if ($form->get('reset')->isClicked()) {
                // Submitted for reset
                // Reset stored content
                $this->clearFilterValues();
                // Reset displayed values by rebuilding the form
                // yes, it's a pity we cannot simply change content of it
                $this->getFiltersForm(true);
            }
            else {
                // Submitted for filtering
                // Overwrite any stored values with the submitted ones
                // Update storage for subsequent requests
                $this->storeFilterValues($form->getData());
            }
        }

        // Map values, if any, to filters
        if (is_array($this->filterValues)) {
            foreach ($this->filters as $filter) {
                if (array_key_exists($filter->getName(), $this->filterValues)) {
                    $filter->setValue($this->filterValues[$filter->getName()]);
                }
            }
        }
    }
private function applyFilters()
    {
        // Manage filters
        // Filter values come either from the form (GET)
        // Or from session
        $form = $this->getFiltersForm();

        if (!$form) {
            // No filters are configured for this admin
            return;
        }

        $this->loadFilterValues();
        // Init form with current data if any
        $form->setData($this->filterValues);

        $form->handleRequest($this->request);

        if ($form->isSubmitted()) {

            if ($form->get('reset')->isClicked()) {
                // Submitted for reset
                // Reset stored content
                $this->clearFilterValues();
                // Reset displayed values by rebuilding the form
                // yes, it's a pity we cannot simply change content of it
                $this->getFiltersForm(true);
            }
            else {
                // Submitted for filtering
                // Overwrite any stored values with the submitted ones
                // Update storage for subsequent requests
                $this->storeFilterValues($form->getData());
            }
        }

        // Map values, if any, to filters
        if (is_array($this->filterValues)) {
            foreach ($this->filters as $filter) {
                if (array_key_exists($filter->getName(), $this->filterValues)) {
                    $filter->setValue($this->filterValues[$filter->getName()]);
                }
            }
        }
    }
private function applyFilters ( ) { // Manage filters // Filter values come either from the form (GET) // Or from session $ form = $ this -> getFiltersForm ( ) ; if ( ! $ form ) { // No filters are configured for this admin return ; } $ this -> loadFilterValues ( ) ; // Init form with current data if any $ form -> setData ( $ this -> filterValues ) ; $ form -> handleRequest ( $ this -> request ) ; if ( $ form -> isSubmitted ( ) ) { if ( $ form -> get ( 'reset' ) -> isClicked ( ) ) { // Submitted for reset // Reset stored content $ this -> clearFilterValues ( ) ; // Reset displayed values by rebuilding the form // yes, it's a pity we cannot simply change content of it $ this -> getFiltersForm ( true ) ; } else { // Submitted for filtering // Overwrite any stored values with the submitted ones // Update storage for subsequent requests $ this -> storeFilterValues ( $ form -> getData ( ) ) ; } } // Map values, if any, to filters if ( is_array ( $ this -> filterValues ) ) { foreach ( $ this -> filters as $ filter ) { if ( array_key_exists ( $ filter -> getName ( ) , $ this -> filterValues ) ) { $ filter -> setValue ( $ this -> filterValues [ $ filter -> getName ( ) ] ) ; } } } }
Prepare filters form, bind filter values to filters
Prepare filters form bind filter values to filters