Necessary to display results in CMS site search.

@return DBField
774910
public function Breadcrumbs()
    {
        $ownerClassName = $this->OwnerClassName;

        if ($owner = $ownerClassName::get()->filter('ElementalAreaID', $this->ID)->first()) {
            return DBField::create_field('HTMLText', sprintf(
                '<a href="%s">%s</a>',
                $owner->CMSEditLink(),
                $owner->Title
            ));
        }

        return null;
    }
1077606
private function buildFields() {
        $fields = array();
        /** @var ResultSet $results */
        $results = $this->getConfiguration()->getConnection()->query('SHOW COLUMNS FROM `' . $this->getTableName() . '`');
        $dbName = $this->getCurrentDatabaseName();
        while($result = $results->fetch()) {
            $result = (object)$result;
            $params = array($dbName, $this->getTableName(), $result->Field);
            /** @var ResultSet $informationResults */
            $informationResults = $this->getConfiguration()->getInformationSchemaConnection()->query(
                'SELECT * FROM `COLUMNS` WHERE TABLE_SCHEMA=? AND TABLE_NAME=? AND COLUMN_NAME=?',
                $params
            );
            /** @var \stdClass $informationResult */
            $informationResult = (object)$informationResults->fetch();
            $field = new Field($result, $this->getTableName(), $informationResult);
            switch($field->getType()) {
                case 'Date':
                    $this->getAbstractClass()->addUse($this->getConfiguration()->getDateClassName());
                    break;
                case 'DateTime':
                    $this->getAbstractClass()->addUse($this->getConfiguration()->getDateTimeClassName());
                    break;
            }
            $fields[] = $field;
        }
        usort(
            $fields,
            function (Field $fieldA, Field $fieldB) {
                return strcasecmp($fieldA->getShortName(), $fieldB->getShortName());
            }
        );
        $this->setFields($fields);
    }
167982
public static function fromCsvField(CsvField $csvField) : DbField
    {
        return new self(
            $csvField->getName(),
            $csvField->getType(),
            $csvField->getLimit(),
            $csvField->getRequired(),
            $csvField->getNonSearchable(),
            $csvField->getUnique()
        );
    }
12658
public function sqlPagination()
    {
        $pager = $this->pagination();
        if (!$pager instanceof DatabasePagination) {
            $pager = $this->createPagination($pager->data());
        }

        $sql = $pager->sql();
        if (strlen($sql) > 0) {
            $sql = ' '.$sql;
        }

        return $sql;
    }
1178845
public function search()
    {
        $criteria = new CDbCriteria;

        $criteria->compare('t.id', $this->id);
        $criteria->compare('t.transport', $this->transport);
        $criteria->compare('t.template', $this->template);
        $criteria->compare('t.priority', $this->priority);
        $criteria->compare('t.status', $this->status);
        $criteria->compare('t.model_id', $this->model_id);
        $criteria->compare('t.to_address', $this->to_address, true);
        $criteria->compare('t.from_address', $this->from_address, true);
        $criteria->compare('t.subject', $this->subject, true);
        $criteria->compare('t.message', $this->message, true);
        $criteria->compare('t.sent', $this->sent);
        $criteria->compare('t.created', $this->created);

        if (is_array($this->model_name)) {
            $criteria->addInCondition('t.model_name', $this->model_name);
        }
        else {
            $criteria->compare('t.model_name', $this->model_name);
        }

        return new CActiveDataProvider($this, array(
            'criteria' => $criteria,
            'sort' => array(
                'defaultOrder' => 'id DESC',
            ),
        ));
    }
561147
protected function select()
    {
        $colNames = array_keys($this->_cols);
        $colValues = DbTable::select(
            $this->db, $this->_tableName, $colNames, $this->id
        );

        $this->_cols = [];
        foreach ($colNames as $colName) {
            $this->_cols[$colName] = $colValues[$colName];
        }

        return $this->_cols["id"];
    }
729813
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                UploadField::create(
                    'Image',
                    $this->fieldLabel('Image')
                )->setAllowedFileCategories('image')->setFolderName($this->getAssetFolder()),
                HTMLEditorField::create(
                    'Caption',
                    $this->fieldLabel('Caption')
                )->setRows(10)
            ],
            'LinkTo'
        );
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'SlideOptions',
                $this->fieldLabel('SlideOptions'),
                [
                    CheckboxField::create(
                        'HideTitle',
                        $this->fieldLabel('HideTitle')
                    ),
                    CheckboxField::create(
                        'HideImage',
                        $this->fieldLabel('HideImage')
                    ),
                    CheckboxField::create(
                        'HideCaption',
                        $this->fieldLabel('HideCaption')
                    ),
                    CheckboxField::create(
                        'LinkDisabled',
                        $this->fieldLabel('LinkDisabled')
                    ),
                    CheckboxField::create(
                        'TitleAfterCaption',
                        $this->fieldLabel('TitleAfterCaption')
                    ),
                    CheckboxField::create(
                        'LinkInFooter',
                        $this->fieldLabel('LinkInFooter')
                    ),
                    CheckboxField::create(
                        'ButtonLink',
                        $this->fieldLabel('ButtonLink')
                    ),
                    TextField::create(
                        'ButtonLabel',
                        $this->fieldLabel('ButtonLabel')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
1252340
public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $TeaserConfig = GridFieldConfig_RecordEditor::create();
        if ($this->LinkList()->Count() > 0) {
            $TeaserConfig->addComponent(new GridFieldOrderableRows());
        }

        $fields->removeByName(
            array(
                'ParentPageID',
                'ParentPage',
                'LinkLimit',
                'LinkList'
            )
        );

        $fields->addFieldsToTab(
            'Root.Main',
            array(
                TextareaField::create(
                    'Title'
                )->setRows(1),
                DropdownField::create(
                    'LinkType',
                    'Type',
                    array(
                        "currentchildren" => "List all sub pages of this page",
                        "children" => "Specify a page and list all its sub pages",
                        "specify" => "Specify each link"
                    )
                ),
                DisplayLogicWrapper::create(
                    TreeDropdownField::create(
                        'ParentPageID',
                        'Select a page',
                        'SiteTree'
                    )
                )->displayIf("LinkType")->isEqualTo("children")->end(),
                DisplayLogicWrapper::create(
                    NumericField::create(
                        'LinkLimit',
                        'Limit links'
                    )
                    ->setDescription("0 equals unlimited amount.")
                )->displayIf("LinkType")->isNotEqualTo("specify")->end(),
                DisplayLogicWrapper::create(
                    GridField::create(
                        'LinkList',
                        'Current Link(s)',
                        $this->LinkList(),
                        $TeaserConfig
                    )
                )->displayIf("LinkType")->isEqualTo("specify")->end()
            )
        );

        $this->extend('updateCMSFields', $fields);

        return $fields;
    }
1244081
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                FieldSection::create(
                    'EmailSection',
                    $this->fieldLabel('Email'),
                    [
                        TextField::create(
                            'EmailSubject',
                            $this->fieldLabel('EmailSubject')
                        )->setRightTitle(
                            _t(
                                __CLASS__ . '.EMAILSUBJECTRIGHTTITLE',
                                'Uses the title of the current page if blank.'
                            )
                        ),
                        TextField::create(
                            'EmailMessage',
                            $this->fieldLabel('EmailMessage')
                        )->setRightTitle(
                            _t(
                                __CLASS__ . '.EMAILMESSAGERIGHTTITLE',
                                'Included in the body of the email before the shared link.'
                            )
                        )
                    ]
                )
            ]
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
759308
public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->addFieldsToTab(
            "Root.Main",
            array(
                DropdownField::create(
                    'ShowHome',
                    'Show home',
                    array(
                        "1" => "Yes",
                        "0" => "No"
                    ),
                    1
                )
            )
        );

        $this->extend('updateCMSFields', $fields);

        return $fields;
    }
332878
public function getSearchForm()
    {
        // Create the fields
        $dateFrom = DateField::create(
            'Search__LastEditedFrom',
            _t('SilverStripe\\CMS\\Search\\SearchForm.FILTERDATEFROM', 'From')
        )->setLocale(Security::getCurrentUser()->Locale);
        $dateTo = DateField::create(
            'Search__LastEditedTo',
            _t('SilverStripe\\CMS\\Search\\SearchForm.FILTERDATETO', 'To')
        )->setLocale(Security::getCurrentUser()->Locale);
        $filters = CMSSiteTreeFilter::get_all_filters();
        // Remove 'All pages' as we set that to empty/default value
        unset($filters[CMSSiteTreeFilter_Search::class]);
        $pageFilter = DropdownField::create(
            'Search__FilterClass',
            _t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGES', 'Page status'),
            $filters
        );
        $pageFilter->setEmptyString(_t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGESALLOPT', 'All pages'));
        $pageClasses = DropdownField::create(
            'Search__ClassName',
            _t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEOPT', 'Page type', 'Dropdown for limiting search to a page type'),
            $this->getPageTypes()
        );
        $pageClasses->setEmptyString(_t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEANYOPT', 'Any'));

        // Group the Datefields
        $dateGroup = FieldGroup::create(
            _t('SilverStripe\\CMS\\Search\\SearchForm.PAGEFILTERDATEHEADING', 'Last edited'),
            [$dateFrom, $dateTo]
        )->setName('Search__LastEdited')
        ->addExtraClass('fieldgroup--fill-width');

        // Create the Field list
        $fields = new FieldList(
            $pageFilter,
            $pageClasses,
            $dateGroup
        );

        // Create the form
        /** @skipUpgrade */
        $form = Form::create(
            $this,
            'SearchForm',
            $fields,
            new FieldList()
        );
        $form->addExtraClass('cms-search-form');
        $form->setFormMethod('GET');
        $form->setFormAction(CMSMain::singleton()->Link());
        $form->disableSecurityToken();
        $form->unsetValidator();

        // Load the form with previously sent search data
        $form->loadDataFrom($this->getRequest()->getVars());

        // Allow decorators to modify the form
        $this->extend('updateSearchForm', $form);

        return $form;
    }
608858
public function getDBFieldFunctions() {
		if($this->dbfieldFunctions) return $this->dbfieldFunctions;

		foreach(ClassInfo::subclassesFor("DBField") as $class) {
			$r = new ReflectionClass($class);
			if($methods = $r->getMethods()) {
				foreach($methods as $m) {
					$name = $m->getName();
					if(preg_match("/[A-Z]/",$name[0])) {
						$this->dbfieldFunctions[strtolower($name)] = $class;
					}						
				}
			}
		}
		// Give a good default for "Nice"
		$this->dbfieldFunctions["Nice"] = "Date";		

		$r = new ReflectionClass("Image");
		if($methods = $r->getMethods()) {
			foreach($methods as $m) {
				$name = $m->getName();
				if(substr($name,0,8) == "generate") {
					$this->dbfieldFunctions[strtolower(substr($name,8))] = "Image";
				}						
			}
		}
		$r = new ReflectionClass("File");
		if($methods = $r->getMethods()) {
			foreach($methods as $m) {
				$name = $m->getName();
				if(substr($name,0,3) == "get") {
					$prop = substr($name,3);
					if(!in_array($prop, array('Title','Name','ID','Parent'))) {
						$this->dbfieldFunctions[strtolower(substr($name,3))] = "File";
					}
				}						
			}
		}

		return $this->dbfieldFunctions;
	}
701721
public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->addFieldsToTab(
            "Root.Main",
            array(
                DropdownField::create(
                    'FormPageID',
                    'Select a page',
                    UserDefinedForm::get()->map('ID', 'Title')
                )
            )
        );

        $this->extend('updateCMSFields', $fields);

        return $fields;
    }
173711
public function getDisplayField() {
        return $this->cache(__METHOD__, function() {
            $fields = $this->getConfig('displayField');
            $schema = $this->getSchema();

            foreach ((array) $fields as $field) {
                if ($schema->hasColumn($field)) {
                    return $field;
                }
            }

            return $this->getPrimaryKey();
        });
    }
179194
private function AddUrlField()
    {
        $name = 'Url';
        $this->AddField(Input::Text($name, $this->page->GetUrl()));
        $this->SetRequired($name);
        $this->AddValidator($name, DatabaseCount::UniqueFieldAnd($this->page, $name, $this->SiteCondition()));
    }
1177914
protected function _loadFromDb()
    {
        $sSql = $this->_getSelectString(false, null, 'oxparentid, oxsort, oxtitle');
        $aData = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->getAll($sSql);

        return $aData;
    }
994521
public function getRawSql()
    {
        $search = array();
        $replace = array();
        $params = $this->getParams();
        ksort($params, SORT_STRING);
        foreach ($params as $key => $value) {
            if (is_int($key)) {
                $key = '?';
            }
            $search[] = $key;
            if (is_string($value)) {
                $value = "'$value'";
            }
            $replace[] = $value;
        }
        return str_replace($search, $replace, $this->getSql());
    }