src/Forms/TreeDropdownField.php
protected function getSearchResults()
    {
        $callback = $this->getSearchFunction();
        if ($callback) {
            return call_user_func($callback, $this->getSourceObject(), $this->getLabelField(), $this->search);
        }

        $sourceObject = $this->getSourceObject();
        $filters = array();
        $sourceObjectInstance = DataObject::singleton($sourceObject);
        $candidates = array_unique([
            $this->getLabelField(),
            $this->getTitleField(),
            'Title',
            'Name'
        ]);
        foreach ($candidates as $candidate) {
            if ($sourceObjectInstance->hasDatabaseField($candidate)) {
                $filters["{$candidate}:PartialMatch"] = $this->search;
            }
        }

        if (empty($filters)) {
            throw new InvalidArgumentException(sprintf(
                'Cannot query by %s.%s, not a valid database column',
                $sourceObject,
                $this->getTitleField()
            ));
        }
        return DataObject::get($this->getSourceObject())->filterAny($filters);
    }
protected function getSearchResults()
    {
        $callback = $this->getSearchFunction();
        if ($callback) {
            return call_user_func($callback, $this->getSourceObject(), $this->getLabelField(), $this->search);
        }

        $sourceObject = $this->getSourceObject();
        $filters = array();
        $sourceObjectInstance = DataObject::singleton($sourceObject);
        $candidates = array_unique([
            $this->getLabelField(),
            $this->getTitleField(),
            'Title',
            'Name'
        ]);
        foreach ($candidates as $candidate) {
            if ($sourceObjectInstance->hasDatabaseField($candidate)) {
                $filters["{$candidate}:PartialMatch"] = $this->search;
            }
        }

        if (empty($filters)) {
            throw new InvalidArgumentException(sprintf(
                'Cannot query by %s.%s, not a valid database column',
                $sourceObject,
                $this->getTitleField()
            ));
        }
        return DataObject::get($this->getSourceObject())->filterAny($filters);
    }
protected function getSearchResults ( ) { $ callback = $ this -> getSearchFunction ( ) ; if ( $ callback ) { return call_user_func ( $ callback , $ this -> getSourceObject ( ) , $ this -> getLabelField ( ) , $ this -> search ) ; } $ sourceObject = $ this -> getSourceObject ( ) ; $ filters = array ( ) ; $ sourceObjectInstance = DataObject :: singleton ( $ sourceObject ) ; $ candidates = array_unique ( [ $ this -> getLabelField ( ) , $ this -> getTitleField ( ) , 'Title' , 'Name' ] ) ; foreach ( $ candidates as $ candidate ) { if ( $ sourceObjectInstance -> hasDatabaseField ( $ candidate ) ) { $ filters [ "{$candidate}:PartialMatch" ] = $ this -> search ; } } if ( empty ( $ filters ) ) { throw new InvalidArgumentException ( sprintf ( 'Cannot query by %s.%s, not a valid database column' , $ sourceObject , $ this -> getTitleField ( ) ) ) ; } return DataObject :: get ( $ this -> getSourceObject ( ) ) -> filterAny ( $ filters ) ; }
Get the DataObjects that matches the searched parameter.

@return DataList
Get the DataObjects that matches the searched parameter .