original_string: protected function _deriveFields()
      {
          $config = $this->getConfig();
          $table = $this->_table();
  
          if (method_exists($table, 'searchConfiguration')) {
              $searchManager = $table->searchConfiguration();
          } else {
              $searchManager = $table->searchManager();
          }
  
          $fields = [];
          $schema = $table->getSchema();
          $request = $this->_request();
  
          foreach ($searchManager->getFilters($config['collection']) as $filter) {
              if ($filter->getConfig('form') === false) {
                  continue;
              }
  
              $field = $filter->name();
              $input = [
                  'required' => false,
                  'type' => 'text'
              ];
  
              if (substr($field, -3) === '_id' && $field !== '_id') {
                  $input['type'] = 'select';
              }
  
              $filterFormConfig = $filter->getConfig('form');
              if (!empty($filterFormConfig)) {
                  $input = $filterFormConfig + $input;
              }
  
              $input['value'] = $request->getQuery($field);
  
              if (empty($input['options']) && $schema->getColumnType($field) === 'boolean') {
                  $input['options'] = ['No', 'Yes'];
                  $input['type'] = 'select';
              }
  
              if (!empty($input['options'])) {
                  $input['empty'] = true;
                  if (empty($input['class']) && !$config['selectize']) {
                      $input['class'] = 'no-selectize';
                  }
  
                  $fields[$field] = $input;
  
                  continue;
              }
  
              if (empty($input['class']) && $config['autocomplete']) {
                  $input['class'] = 'autocomplete';
              }
  
              $urlArgs = [];
  
              $fieldKeys = isset($input['fields']) ? $input['fields'] : ['id' => $field, 'value' => $field];
              if (is_array($fieldKeys)) {
                  foreach ($fieldKeys as $key => $val) {
                      $urlArgs[$key] = $val;
                  }
              }
  
              unset($input['fields']);
              $url = array_merge(['action' => 'lookup', '_ext' => 'json'], $urlArgs);
              $input['data-url'] = Router::url($url);
  
              $fields[$field] = $input;
          }
  
          return $fields;
      }
code: protected function _deriveFields()
      {
          $config = $this->getConfig();
          $table = $this->_table();
  
          if (method_exists($table, 'searchConfiguration')) {
              $searchManager = $table->searchConfiguration();
          } else {
              $searchManager = $table->searchManager();
          }
  
          $fields = [];
          $schema = $table->getSchema();
          $request = $this->_request();
  
          foreach ($searchManager->getFilters($config['collection']) as $filter) {
              if ($filter->getConfig('form') === false) {
                  continue;
              }
  
              $field = $filter->name();
              $input = [
                  'required' => false,
                  'type' => 'text'
              ];
  
              if (substr($field, -3) === '_id' && $field !== '_id') {
                  $input['type'] = 'select';
              }
  
              $filterFormConfig = $filter->getConfig('form');
              if (!empty($filterFormConfig)) {
                  $input = $filterFormConfig + $input;
              }
  
              $input['value'] = $request->getQuery($field);
  
              if (empty($input['options']) && $schema->getColumnType($field) === 'boolean') {
                  $input['options'] = ['No', 'Yes'];
                  $input['type'] = 'select';
              }
  
              if (!empty($input['options'])) {
                  $input['empty'] = true;
                  if (empty($input['class']) && !$config['selectize']) {
                      $input['class'] = 'no-selectize';
                  }
  
                  $fields[$field] = $input;
  
                  continue;
              }
  
              if (empty($input['class']) && $config['autocomplete']) {
                  $input['class'] = 'autocomplete';
              }
  
              $urlArgs = [];
  
              $fieldKeys = isset($input['fields']) ? $input['fields'] : ['id' => $field, 'value' => $field];
              if (is_array($fieldKeys)) {
                  foreach ($fieldKeys as $key => $val) {
                      $urlArgs[$key] = $val;
                  }
              }
  
              unset($input['fields']);
              $url = array_merge(['action' => 'lookup', '_ext' => 'json'], $urlArgs);
              $input['data-url'] = Router::url($url);
  
              $fields[$field] = $input;
          }
  
          return $fields;
      }
code_tokens: protected function _deriveFields ( ) { $ config = $ this -> getConfig ( ) ; $ table = $ this -> _table ( ) ; if ( method_exists ( $ table , 'searchConfiguration' ) ) { $ searchManager = $ table -> searchConfiguration ( ) ; } else { $ searchManager = $ table -> searchManager ( ) ; } $ fields = [ ] ; $ schema = $ table -> getSchema ( ) ; $ request = $ this -> _request ( ) ; foreach ( $ searchManager -> getFilters ( $ config [ 'collection' ] ) as $ filter ) { if ( $ filter -> getConfig ( 'form' ) === false ) { continue ; } $ field = $ filter -> name ( ) ; $ input = [ 'required' => false , 'type' => 'text' ] ; if ( substr ( $ field , - 3 ) === '_id' && $ field !== '_id' ) { $ input [ 'type' ] = 'select' ; } $ filterFormConfig = $ filter -> getConfig ( 'form' ) ; if ( ! empty ( $ filterFormConfig ) ) { $ input = $ filterFormConfig + $ input ; } $ input [ 'value' ] = $ request -> getQuery ( $ field ) ; if ( empty ( $ input [ 'options' ] ) && $ schema -> getColumnType ( $ field ) === 'boolean' ) { $ input [ 'options' ] = [ 'No' , 'Yes' ] ; $ input [ 'type' ] = 'select' ; } if ( ! empty ( $ input [ 'options' ] ) ) { $ input [ 'empty' ] = true ; if ( empty ( $ input [ 'class' ] ) && ! $ config [ 'selectize' ] ) { $ input [ 'class' ] = 'no-selectize' ; } $ fields [ $ field ] = $ input ; continue ; } if ( empty ( $ input [ 'class' ] ) && $ config [ 'autocomplete' ] ) { $ input [ 'class' ] = 'autocomplete' ; } $ urlArgs = [ ] ; $ fieldKeys = isset ( $ input [ 'fields' ] ) ? $ input [ 'fields' ] : [ 'id' => $ field , 'value' => $ field ] ; if ( is_array ( $ fieldKeys ) ) { foreach ( $ fieldKeys as $ key => $ val ) { $ urlArgs [ $ key ] = $ val ; } } unset ( $ input [ 'fields' ] ) ; $ url = array_merge ( [ 'action' => 'lookup' , '_ext' => 'json' ] , $ urlArgs ) ; $ input [ 'data-url' ] = Router :: url ( $ url ) ; $ fields [ $ field ] = $ input ; } return $ fields ; }
docstring: Derive field options for search filter inputs based on filter collection.
  
  @return array
docstring_tokens: Derive field options for search filter inputs based on filter collection .