src/FormField/Lookup.php
public function renderFilters()
    {
        if (isset($_GET['filter'])) {
            if (isset($_GET['q'])) {
                $this->model->addCondition($_GET['filter'], 'like', '%'.$_GET['q'].'%');
            }
            // Apply filtering to filter.
            $this->applyFilters();
            $action = $this->model->action('field', [$_GET['filter']]);
            $action->group($_GET['filter']);
            $rows = $action->get();
            $data = [];
            foreach ($rows as $k => $v) {
                $data[] = ['id' => $k, 'name' => $v[$_GET['filter']]];
            }
            array_unshift($data, ['id' => -1, 'name' => $this->filterEmpty]);

            $this->app->terminate(json_encode([
                                                  'success' => true,
                                                  'results' => $data,
                                              ]));
        }
    }
public function renderFilters()
    {
        if (isset($_GET['filter'])) {
            if (isset($_GET['q'])) {
                $this->model->addCondition($_GET['filter'], 'like', '%'.$_GET['q'].'%');
            }
            // Apply filtering to filter.
            $this->applyFilters();
            $action = $this->model->action('field', [$_GET['filter']]);
            $action->group($_GET['filter']);
            $rows = $action->get();
            $data = [];
            foreach ($rows as $k => $v) {
                $data[] = ['id' => $k, 'name' => $v[$_GET['filter']]];
            }
            array_unshift($data, ['id' => -1, 'name' => $this->filterEmpty]);

            $this->app->terminate(json_encode([
                                                  'success' => true,
                                                  'results' => $data,
                                              ]));
        }
    }
public function renderFilters ( ) { if ( isset ( $ _GET [ 'filter' ] ) ) { if ( isset ( $ _GET [ 'q' ] ) ) { $ this -> model -> addCondition ( $ _GET [ 'filter' ] , 'like' , '%' . $ _GET [ 'q' ] . '%' ) ; } // Apply filtering to filter. $ this -> applyFilters ( ) ; $ action = $ this -> model -> action ( 'field' , [ $ _GET [ 'filter' ] ] ) ; $ action -> group ( $ _GET [ 'filter' ] ) ; $ rows = $ action -> get ( ) ; $ data = [ ] ; foreach ( $ rows as $ k => $ v ) { $ data [ ] = [ 'id' => $ k , 'name' => $ v [ $ _GET [ 'filter' ] ] ] ; } array_unshift ( $ data , [ 'id' => - 1 , 'name' => $ this -> filterEmpty ] ) ; $ this -> app -> terminate ( json_encode ( [ 'success' => true , 'results' => $ data , ] ) ) ; } }
Check if filtering is needed and terminate app execution.
Check if filtering is needed and terminate app execution .