Add the Fluent state badge before any existing badges and return the result

@param DBField|null $badgeField
@param DataObject $record
@return DBField|null
772507
protected function addFluentBadge($badgeField, DataObject $record)
    {
        // Check for a fluent state before continuing
        if (!FluentState::singleton()->getLocale()
            || !$record->has_extension(FluentVersionedExtension::class)
        ) {
            return null;
        }

        $fluentBadge = $this->getBadge($record);
        // Add fluent badge before any existing badges
        $newBadge = DBField::create_field('HTMLFragment', $fluentBadge . $badgeField);

        return $newBadge;
    }
1118575
public BaseTable doMakeTable(Record record)
    {
        BaseTable table = null;
        boolean bIsQueryRecord = record.isQueryRecord();
        if (m_pDatabase == null)
        {
            try   {
                this.open();
            } catch (DBException ex)    {
                return null;        // No database
            }
        }
        if (bIsQueryRecord)
        { // Physical Tables cannot process SQL queries, so use QueryTable!
            PassThruTable passThruTable = new QueryTable(this, record);
            passThruTable.addTable(record.getRecordlistAt(0).getTable());
            return passThruTable;
        }
        table = this.makePhysicalTable(record);
        return table;
    }
310268
public function fillRecordWithRelations(Record $record)
    {
        foreach ($this->getWith() as $relation) {
            $relation->fillRecord($record);
        }

        return $record;
    }
154594
public function saveInto(DataObjectInterface $record)
    {
        // Obtain Field Name:
        
        $fieldName = $this->getName();
        
        // Bail Early (if needed):
        
        if (empty($fieldName) || empty($record)) {
            return;
        }
        
        // Determine Value Mode:
        
        if (!$this->isMultiple()) {
            
            // Save Singular Value:
            
            parent::saveInto($record);
            
        } else {
            
            // Save Multiple Value:
            
            $relation = $this->getNamedRelation($record);
            
            if ($relation instanceof Relation) {
                $this->saveIntoRelation($relation);
            } elseif ($record->hasField($fieldName)) {
                $record->$fieldName = $this->stringEncode($this->getValueArray());
            }
            
        }
    }
142744
public function getColumnContent($gridField, $record, $columnName)
    {
        $data = new ArrayData(array(
            'Link' => $record->hasMethod('getExternalLink') ? $record->getExternalLink() : $record->ExternalLink,
            'Text' => $record->hasMethod('getExternalLinkText') ? $record->getExternalLinkText() : 'External Link'
        ));

        return $data->renderWith('GridFieldExternalLink');
    }
1205308
public function addRecord(\Gpupo\CommonSchema\ORM\Entity\Banking\Report\Record $record)
    {
        $this->records[] = $record;

        return $this;
    }
820902
public static function populateRecord($record, $row)
    {
        $dynCol = static::dynamicColumn();
        if (isset($row[$dynCol])) {
            $record->_dynamicAttributes = static::dynColDecode($row[$dynCol]);
        }
        parent::populateRecord($record, $row);
    }
539591
protected static function extract_object_from_record($record, $prefix, $additionalfields = []) {
        $object = new \stdClass();
        foreach ($record as $key => $value) {
            if (preg_match('/^'.preg_quote($prefix, '/').'(.*)/', $key, $matches)) {
                $object->{$matches[1]} = $value;
            }
        }
        if ($additionalfields) {
            foreach ($additionalfields as $key => $value) {
                $object->$key = $value;
            }
        }
        return $object;
    }
673035
public static function set_contextlevel($record) {
        global $DB;

        if ($record->contextlevel != CONTEXT_SYSTEM && $record->contextlevel != CONTEXT_USER) {
            throw new \coding_exception('Only context system and context user can set a contextlevel ' .
                'purpose and retention');
        }

        if ($contextlevel = contextlevel::get_record_by_contextlevel($record->contextlevel, false)) {
            // Update.
            $contextlevel->from_record($record);
        } else {
            // Add.
            $contextlevel = new contextlevel(0, $record);
        }
        $contextlevel->save();

        // We sync with their defaults as we removed these options from the defaults page.
        $classname = \context_helper::get_class_for_level($record->contextlevel);
        list($purposevar, $categoryvar) = data_registry::var_names_from_context($classname);
        set_config($purposevar, $record->purposeid, 'tool_dataprivacy');
        set_config($categoryvar, $record->categoryid, 'tool_dataprivacy');

        return $contextlevel;
    }
980394
protected function addVersionedButtons(DataObject $record, FieldList $actions)
    {
        // Save & Publish action
        if ($record->canPublish()) {
            // "publish", as with "save", it supports an alternate state to show when action is needed.
            $publish = FormAction::create(
                'doPublish',
                _t(__CLASS__ . '.BUTTONPUBLISH', 'Publish')
            )
                ->setUseButtonTag(true)
                ->addExtraClass('btn btn-primary font-icon-rocket');

            // Insert after save
            if ($actions->fieldByName('action_doSave')) {
                $actions->insertAfter('action_doSave', $publish);
            } else {
                $actions->push($publish);
            }
        }

        // Unpublish action
        if ($record->isInDB() && $record->canUnpublish()) {
            /** @var DataObject|Versioned|RecursivePublishable $liveRecord */
            $liveRecord = Versioned::get_by_stage($record->baseClass(), Versioned::LIVE)
                ->byID($record->ID);
            if ($liveRecord) {
                $liveOwners = $liveRecord->findOwners(false)->count();
                $actions->push(
                    FormAction::create(
                        'doUnpublish',
                        _t(__CLASS__ . '.BUTTONUNPUBLISH', 'Unpublish')
                    )
                        ->setUseButtonTag(true)
                        ->setDescription(_t(
                            __CLASS__ . '.BUTTONUNPUBLISHDESC',
                            'Remove this record from the published site'
                        ))
                        ->addExtraClass('btn-secondary')
                        ->setAttribute('data-owners', $liveOwners)
                );
            }
        }

        // Archive action
        if ($record->isInDB() && $record->canArchive()) {
            // Replace "delete" action
            $actions->removeByName('action_doDelete');

            // "archive"
            $actions->push(
                FormAction::create('doArchive', _t(__CLASS__ . '.ARCHIVE', 'Archive'))
                    ->setUseButtonTag(true)
                    ->setDescription(_t(
                        __CLASS__ . '.BUTTONARCHIVEDESC',
                        'Unpublish and send to archive'
                    ))
                    ->addExtraClass('btn-secondary action--archive font-icon-box')
            );
        }
    }
234902
public function getColumnContent($gridField, $record, $columnName)
    {
        $cb = CheckboxField::create('bulkSelect_' . $record->ID)
            ->addExtraClass('bulkSelect no-change-track')
            ->setAttribute('data-record', $record->ID);

        return $cb->Field();
    }
895377
public function loadFrom(DataObjectInterface $record)
    {
        // Obtain Field Name:
        
        $fieldName = $this->getName();
        
        // Bail Early (if needed):
        
        if (empty($fieldName) || empty($record)) {
            return;
        }
        
        // Determine Value Mode:
        
        if (!$this->isMultiple()) {
            
            // Load Singular Value:
            
            parent::setValue($record->$fieldName);
            
        } else {
            
            // Load Multiple Value:
            
            $relation = $this->getNamedRelation($record);
            
            if ($relation instanceof Relation) {
                $this->loadFromRelation($relation);
            } elseif ($record->hasField($fieldName)) {
                parent::setValue($this->stringDecode($record->$fieldName));
            }
            
        }
    }
484371
protected function findAssets(DataObject $record)
    {
        // Search for dbfile instances
        $files = array();
        $fields = DataObject::getSchema()->fieldSpecs($record);
        foreach ($fields as $field => $db) {
            $fieldObj = $record->$field;
            if (!($fieldObj instanceof DBFile)) {
                continue;
            }

            // Omit variant and merge with set
            $next = $record->dbObject($field)->getValue();
            unset($next['Variant']);
            if ($next) {
                $files[] = $next;
            }
        }

        // De-dupe
        return array_map("unserialize", array_unique(array_map("serialize", $files)));
    }
837574
protected function getPopoverMenu($record)
    {
        // Build popover actions
        $popoverActions = $this->getPopoverActions($record);
        if ($popoverActions) {
            return PopoverField::create($popoverActions)
                ->setPlacement('top')
                ->setName('PopoverActions')
                ->setButtonTooltip(_t(
                    'SilverStripe\\AssetAdmin\\Forms\\FileFormFactory.OTHER_ACTIONS',
                    'Other actions'
                ));
        }
        return null;
    }
726798
protected function addRecord (Record $record) 
    {
        if ($this->containsRecord($record)) {
            throw new InvalidArgumentException("{$this} already contains {$record}");
        }
        $this->_records []= $record;
    }
135659
public static function setValue(DBField $dbField, $value, $record = null)
    {
        $canEdit = Controller::has_curr() && (Controller::curr() instanceof Page_Controller && Controller::curr()->data()->canEdit());
        if (!$canEdit) {
            $canEdit = is_object($record) && in_array(get_class($record), self::$EditableClasses) && method_exists($record, 'canEdit') && $record->canEdit();
        }
        if ($canEdit && $record && is_object($record) && $dbField->getName()) {
            $dbField->makeEditable  = true;
            $dbField->editClassName = $record->ClassName;
            $dbField->editID        = $record->ID;
        }
    }
923207
public void updateRecord(final ORecordInternal<?> record) {
    if (isEnabled() && record.getIdentity().getClusterId() != excludedCluster && record.getIdentity().isValid()) {
      underlying.lock(record.getIdentity());
      try {
        if (underlying.get(record.getIdentity()) != record)
          underlying.put(record);
      } finally {
        underlying.unlock(record.getIdentity());
      }
    }

    secondary.updateRecord(record);
  }