src/Utility/BasicSearch.php
protected function getFields(): array
    {
        if (empty($this->searchFields)) {
            return [];
        }

        $event = new Event((string)EventName::MODEL_SEARCH_BASIC_SEARCH_FIELDS(), $this, [
            'table' => $this->table
        ]);
        EventManager::instance()->dispatch($event);

        $result = (array)$event->result;

        if (empty($result)) {
            $result = (array)$this->table->aliasField($this->table->getDisplayField());
        }

        $result = $this->filterFields($result);

        if (!empty($result)) {
            return $result;
        }

        $result = $this->getDefaultFields();

        return $result;
    }
protected function getFields(): array
    {
        if (empty($this->searchFields)) {
            return [];
        }

        $event = new Event((string)EventName::MODEL_SEARCH_BASIC_SEARCH_FIELDS(), $this, [
            'table' => $this->table
        ]);
        EventManager::instance()->dispatch($event);

        $result = (array)$event->result;

        if (empty($result)) {
            $result = (array)$this->table->aliasField($this->table->getDisplayField());
        }

        $result = $this->filterFields($result);

        if (!empty($result)) {
            return $result;
        }

        $result = $this->getDefaultFields();

        return $result;
    }
protected function getFields ( ) : array { if ( empty ( $ this -> searchFields ) ) { return [ ] ; } $ event = new Event ( ( string ) EventName :: MODEL_SEARCH_BASIC_SEARCH_FIELDS ( ) , $ this , [ 'table' => $ this -> table ] ) ; EventManager :: instance ( ) -> dispatch ( $ event ) ; $ result = ( array ) $ event -> result ; if ( empty ( $ result ) ) { $ result = ( array ) $ this -> table -> aliasField ( $ this -> table -> getDisplayField ( ) ) ; } $ result = $ this -> filterFields ( $ result ) ; if ( ! empty ( $ result ) ) { return $ result ; } $ result = $ this -> getDefaultFields ( ) ; return $ result ; }
Method that broadcasts an Event to generate the basic search fields.
If the Event result is empty then it falls back to using the display field.
If the display field is a virtual one then if falls back to searchable fields,
using the ones that their type matches the basicSearchFieldTypes list.

@return mixed[]
Method that broadcasts an Event to generate the basic search fields . If the Event result is empty then it falls back to using the display field . If the display field is a virtual one then if falls back to searchable fields using the ones that their type matches the basicSearchFieldTypes list .