HTML for the column, content of the <td> element.

@param  GridField $gridField
@param  DataObject $record - Record displayed in this row
@param  string $columnName
@return string - HTML for the column. Return NULL to skip.
422289
public function getColumnContent($gridField, $record, $columnName)
    {
        if ($columnName === self::CHECKBOX_COLUMN) {
            return '<input class="multiselect no-change-track" type="checkbox"
					name="' . $columnName . '[' . $record->ID . ']"
					value="' . $record->ID . '">';
        } else {
            return null;
        }
    }
1000108
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
    {
        int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
        if (iErrorCode != DBConstants.NORMAL_RETURN)
            return iErrorCode;
        if (iChangeType == DBConstants.UPDATE_TYPE)
        {   // Special case - Even though the record can't be used, GridTable needs a snapshot of the merged record
            Record recMain = this.getNextTable().getRecord();
            Record recAlt = this.getAltRecord();
            this.syncRecords(recAlt, recMain);  // NOTE: Although I put the wrong fields into the main record, modified = false! (so they don't update)
        }
        return iErrorCode;
    }
415693
public function getCaptionFieldLabel(RecordInterface $record, $fieldName)
    {
        if ($record) {
            /** @var \appbox $appbox */
            $appbox = $this->app['phraseanet.appbox'];
            $databox = $appbox->get_databox($record->getDataboxId());
            foreach ($databox->get_meta_structure() as $meta) {
                /** @var \databox_field $meta */
                if ($meta->get_name() === $fieldName) {
                    return $meta->get_label($this->app['locale']);
                }
            }
        }

        return '';
    }
479688
public function getFieldEditorGrid()
    {
        Requirements::javascript('silverstripe/userforms:client/dist/js/userforms-cms.js');

        $fields = $this->owner->Fields();

        $this->createInitialFormStep(true);

        $editableColumns = new GridFieldEditableColumns();
        $fieldClasses = singleton(EditableFormField::class)->getEditableFieldClasses();
        $editableColumns->setDisplayFields([
            'ClassName' => function ($record, $column, $grid) use ($fieldClasses) {
                if ($record instanceof EditableFormField) {
                    return $record->getInlineClassnameField($column, $fieldClasses);
                }
            },
            'Title' => function ($record, $column, $grid) {
                if ($record instanceof EditableFormField) {
                    return $record->getInlineTitleField($column);
                }
            }
        ]);

        $config = GridFieldConfig::create()
            ->addComponents(
                $editableColumns,
                new GridFieldButtonRow(),
                (new GridFieldAddClassesButton(EditableTextField::class))
                    ->setButtonName(_t(__CLASS__.'.ADD_FIELD', 'Add Field'))
                    ->setButtonClass('btn-primary'),
                (new GridFieldAddClassesButton(EditableFormStep::class))
                    ->setButtonName(_t(__CLASS__.'.ADD_PAGE_BREAK', 'Add Page Break'))
                    ->setButtonClass('btn-secondary'),
                (new GridFieldAddClassesButton([EditableFieldGroup::class, EditableFieldGroupEnd::class]))
                    ->setButtonName(_t(__CLASS__.'.ADD_FIELD_GROUP', 'Add Field Group'))
                    ->setButtonClass('btn-secondary'),
                $editButton = new GridFieldEditButton(),
                new GridFieldDeleteAction(),
                new GridFieldToolbarHeader(),
                new GridFieldOrderableRows('Sort'),
                new GridFieldDetailForm()
            );

        $editButton->removeExtraClass('grid-field__icon-action--hidden-on-hover');

        $fieldEditor = GridField::create(
            'Fields',
            '',
            $fields,
            $config
        )->addExtraClass('uf-field-editor');

        return $fieldEditor;
    }
647697
public function getHTML($columnNames = null)
    {
        if ($this->isTerminal) {
            $value = "<b>$this->classValue</b>";
        } else {
            $value = $this->value;
            if ($columnNames !== null) {
                $col = $columnNames[$this->columnIndex];
            } else {
                $col = "col_$this->columnIndex";
            }
            if (!preg_match("/^[<>=]{1,2}/", $value)) {
                $value = "=$value";
            }
            $value = "<b>$col $value</b><br>Gini: ". number_format($this->giniIndex, 2);
        }
        $str = "<table ><tr><td colspan=3 align=center style='border:1px solid;'>
				$value</td></tr>";
        if ($this->leftLeaf || $this->rightLeaf) {
            $str .='<tr>';
            if ($this->leftLeaf) {
                $str .="<td valign=top><b>| Yes</b><br>" . $this->leftLeaf->getHTML($columnNames) . "</td>";
            } else {
                $str .='<td></td>';
            }
            $str .='<td>&nbsp;</td>';
            if ($this->rightLeaf) {
                $str .="<td valign=top align=right><b>No |</b><br>" . $this->rightLeaf->getHTML($columnNames) . "</td>";
            } else {
                $str .='<td></td>';
            }
            $str .= '</tr>';
        }
        $str .= '</table>';
        return $str;
    }
581519
public function getColumnValueRaw($record, $column)
    {
        $columnName = $column->columnName;

        /*
         * Handle taking value from model relation.
         */
        if ($column->valueFrom && $column->relation) {
            $columnName = $column->relation;

            if (!array_key_exists($columnName, $record->getRelations())) {
                $value = null;
            }
            elseif ($this->isColumnRelated($column, true)) {
                $value = $record->{$columnName}->lists($column->valueFrom);
            }
            elseif ($this->isColumnRelated($column) || $this->isColumnPivot($column)) {
                $value = $record->{$columnName}
                    ? $column->getValueFromData($record->{$columnName})
                    : null;
            }
            else {
                $value = null;
            }
        }
        /*
         * Handle taking value from model attribute.
         */
        elseif ($column->valueFrom) {
            $value = $column->getValueFromData($record);
        }
        /*
         * Otherwise, if the column is a relation, it will be a custom select,
         * so prevent the Model from attempting to load the relation
         * if the value is NULL.
         */
        else {
            if ($record->hasRelation($columnName) && array_key_exists($columnName, $record->attributes)) {
                $value = $record->attributes[$columnName];
            // Load the value from the relationship counter if useRelationCount is specified
            } elseif ($column->relation && @$column->config['useRelationCount']) {
                $value = $record->{"{$column->relation}_count"};
            } else {
                $value = $record->{$columnName};
            }
        }

        /**
         * @event backend.list.overrideColumnValueRaw
         * Overrides the raw column value in a list widget.
         *
         * If a value is returned from this event, it will be used as the raw value for the provided column.
         * `$value` is passed by reference so modifying the variable in place is also supported. Example usage:
         *
         *     Event::listen('backend.list.overrideColumnValueRaw', function($listWidget, $record, $column, &$value) {
         *         $value .= '-modified';
         *     });
         *
         * Or
         *
         *     $listWidget->bindEvent('list.overrideColumnValueRaw', function ($record, $column, $value) {
         *         return 'No values for you!';
         *     });
         *
         */
        if ($response = $this->fireSystemEvent('backend.list.overrideColumnValueRaw', [$record, $column, &$value])) {
            $value = $response;
        }

        return $value;
    }
342907
public function get_row_html($row, $classname = '') {
        static $suppress_lastrow = NULL;
        $rowclasses = array();

        if ($classname) {
            $rowclasses[] = $classname;
        }

        $rowid = $this->uniqueid . '_r' . $this->currentrow;
        $html = '';

        $html .= html_writer::start_tag('tr', array('class' => implode(' ', $rowclasses), 'id' => $rowid));

        // If we have a separator, print it
        if ($row === NULL) {
            $colcount = count($this->columns);
            $html .= html_writer::tag('td', html_writer::tag('div', '',
                    array('class' => 'tabledivider')), array('colspan' => $colcount));

        } else {
            $colbyindex = array_flip($this->columns);
            foreach ($row as $index => $data) {
                $column = $colbyindex[$index];

                $attributes = [
                    'class' => "cell c{$index}" . $this->column_class[$column],
                    'id' => "{$rowid}_c{$index}",
                    'style' => $this->make_styles_string($this->column_style[$column]),
                ];

                $celltype = 'td';
                if ($this->headercolumn && $column == $this->headercolumn) {
                    $celltype = 'th';
                    $attributes['scope'] = 'row';
                }

                if (empty($this->prefs['collapse'][$column])) {
                    if ($this->column_suppress[$column] && $suppress_lastrow !== NULL && $suppress_lastrow[$index] === $data) {
                        $content = '&nbsp;';
                    } else {
                        $content = $data;
                    }
                } else {
                    $content = '&nbsp;';
                }

                $html .= html_writer::tag($celltype, $content, $attributes);
            }
        }

        $html .= html_writer::end_tag('tr');

        $suppress_enabled = array_sum($this->column_suppress);
        if ($suppress_enabled) {
            $suppress_lastrow = $row;
        }
        $this->currentrow++;
        return $html;
    }
135151
public function getColumnContent($gridField, $record, $columnName)
    {
        $flagContent = '';
        $flags = $this->getStatusFlags($record);
        foreach ($flags as $class => $data) {
            $flagAttributes = [
                'class' => "ss-gridfield-badge badge status-{$class}",
            ];
            if (isset($data['title'])) {
                $flagAttributes['title'] = $data['title'];
            }
            $flagContent .= ' ' . HTML::createTag('span', $flagAttributes, Convert::raw2xml($data['text']));
        }
        return $flagContent;
    }
1136649
public function getFields(GridField $grid, DataObjectInterface $record)
    {
        $cols   = $this->getDisplayFields($grid);
        $fields = new FieldList();

        /** @var DataList $list */
        $list   = $grid->getList();
        $class  = $list ? $list->dataClass() : null;

        foreach ($cols as $col => $info) {
            $field = null;

            if ($info instanceof Closure) {
                $field = call_user_func($info, $record, $col, $grid);
            } elseif (is_array($info)) {
                if (isset($info['callback'])) {
                    $field = call_user_func($info['callback'], $record, $col, $grid);
                } elseif (isset($info['field'])) {
                    if ($info['field'] == LiteralField::class) {
                        $field = new $info['field']($col, null);
                    } else {
                        $field = new $info['field']($col);
                    }
                }

                if (!$field instanceof FormField) {
                    throw new Exception(sprintf(
                        'The field for column "%s" is not a valid form field',
                        $col
                    ));
                }
            }

            if (!$field && $list instanceof ManyManyList) {
                $extra = $list->getExtraFields();

                if ($extra && array_key_exists($col, $extra)) {
                    $field = Injector::inst()->create($extra[$col], $col)->scaffoldFormField();
                }
            }

            if (!$field) {
                if (!$this->displayFields) {
                    // If setDisplayFields() not used, utilize $summary_fields
                    // in a way similar to base class
                    //
                    // Allows use of 'MyBool.Nice' and 'MyHTML.NoHTML' so that
                    // GridFields not using inline editing still look good or
                    // revert to looking good in cases where the field isn't
                    // available or is readonly
                    //
                    $colRelation = explode('.', $col);
                    if ($class && $obj = DataObject::singleton($class)->dbObject($colRelation[0])) {
                        $field = $obj->scaffoldFormField();
                    } else {
                        $field = new ReadonlyField($colRelation[0]);
                    }
                } elseif ($class && $obj = DataObject::singleton($class)->dbObject($col)) {
                    $field = $obj->scaffoldFormField();
                } else {
                    $field = new ReadonlyField($col);
                }
            }

            if (!$field instanceof FormField) {
                throw new Exception(sprintf(
                    'Invalid form field instance for column "%s"',
                    $col
                ));
            }

            // Add CSS class for interactive fields
            if (!($field->isReadOnly() || $field instanceof LiteralField)) {
                $field->addExtraClass('editable-column-field');
            }

            $fields->push($field);
        }

        return $fields;
    }
643104
public function getTemplateParameters(GridField $gridField)
    {
        $state = $this->getGridPagerState();
        if (is_numeric($state->pageSize)) {
            $this->setItemsPerPage($state->pageSize);
        }
        $arguments = $this->getPagerArguments();

        // Figure out which page and record range we're on
        if (!$arguments['total-rows']) {
            return null;
        }

        // Define a list of the FormActions that should be generated for pager controls (see getPagerActions())
        $controls = array(
            'first' => array(
                'title' => 'First',
                'args' => array('first-shown' => 1),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-left '
                    . 'ss-gridfield-pagination-action ss-gridfield-firstpage',
                'disable-previous' => ($this->getCurrentPage() == 1)
            ),
            'prev' => array(
                'title' => 'Previous',
                'args' => array('first-shown' => $arguments['first-shown'] - $this->getItemsPerPage()),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-left '
                    . 'ss-gridfield-pagination-action ss-gridfield-previouspage',
                'disable-previous' => ($this->getCurrentPage() == 1)
            ),
            'next' => array(
                'title' => 'Next',
                'args' => array('first-shown' => $arguments['first-shown'] + $this->getItemsPerPage()),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-right '
                .'ss-gridfield-pagination-action  ss-gridfield-nextpage',
                'disable-next' => ($this->getCurrentPage() == $arguments['total-pages'])
            ),
            'last' => array(
                'title' => 'Last',
                'args' => array('first-shown' => ($this->getTotalPages() - 1) * $this->getItemsPerPage() + 1),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-right '
                    . 'ss-gridfield-pagination-action ss-gridfield-lastpage',
                'disable-next' => ($this->getCurrentPage() == $arguments['total-pages'])
            ),
            'pagesize' => array(
                'title' => 'Page Size',
                'args' => array('first-shown' => $arguments['first-shown']),
                'extra-class' => 'ss-gridfield-pagination-action ss-gridfield-pagesize-submit'
            ),
        );

        if ($controls['prev']['args']['first-shown'] < 1) {
            $controls['prev']['args']['first-shown'] = 1;
        }

        $actions = $this->getPagerActions($controls, $gridField);

        // Render in template
        return ArrayData::create(array(
            'OnlyOnePage' => ($arguments['total-pages'] == 1),
            'FirstPage' => $actions['first'],
            'PreviousPage' => $actions['prev'],
            'NextPage' => $actions['next'],
            'LastPage' => $actions['last'],
            'PageSizesSubmit' => $actions['pagesize'],
            'CurrentPageNum' => $this->getCurrentPage(),
            'NumPages' => $arguments['total-pages'],
            'FirstShownRecord' => $arguments['first-shown'],
            'LastShownRecord' => $arguments['last-shown'],
            'NumRecords' => $arguments['total-rows'],
            'PageSizes' => $this->getPageSizesAsList(),
            'PageSizesName' => $gridField->getName() . '[page-sizes]',
        ));
    }
1172088
public function getTitle(GridField $gridField)
    {
        $form = $gridField->getForm();
        $currentController = $gridField->getForm()->getController();
        $title = '';

        if (method_exists($currentController, 'Title')) {
            $title = $currentController->Title();
        } else {
            if ($currentController->Title) {
                $title = $currentController->Title;
            } elseif ($form->getName()) {
                $title = $form->getName();
            }
        }

        if ($fieldTitle = $gridField->Title()) {
            if ($title) {
                $title .= " - ";
            }

            $title .= $fieldTitle;
        }

        return $title;
    }
893920
protected function processRecord($record, $columnMap, &$results, $preview = false)
    {
        if (!is_array($record) || empty($record) || !array_filter($record)) {
            $results->addSkipped("Empty/invalid record data.");
            return;
        }
        //map incoming record according to the standardisation mapping (columnMap)
        $record = $this->columnMapRecord($record);
        //skip if required data is not present
        if (!$this->hasRequiredData($record)) {
            $results->addSkipped("Required data is missing.");
            return;
        }
        $modelClass = $this->objectClass;
        $placeholder = new $modelClass();

        //populate placeholder object with transformed data
        foreach ($this->mappableFields_cache as $field => $label) {
            //skip empty fields
            if (!isset($record[$field]) || empty($record[$field])) {
                continue;
            }
            $this->transformField($placeholder, $field, $record[$field]);
        }
        //find existing duplicate of placeholder data
        $obj = null;
        $existing = null;
        if (!$placeholder->ID && !empty($this->duplicateChecks)) {
            $data = $placeholder->getQueriedDatabaseFields();
            //don't match on ID, ClassName or RecordClassName
            unset($data['ID'], $data['ClassName'], $data['RecordClassName']);
            $existing = $this->findExistingObject($data);
        }
        if ($existing) {
            $obj = $existing;
            $obj->update($data);
        } else {
            // new record
            if (!$this->addNewRecords) {
                $results->addSkipped('New record not added');
                return;
            }
            $obj = $placeholder;
        }

        //callback access to every object
        if (is_callable($this->recordCallback)) {
            $callback  = $this->recordCallback;
            $callback($obj, $record);
        }

        $changed = $existing && $obj->isChanged();
        //try/catch for potential write() ValidationException
        try {
            // write obj record
            $obj->write();

            //publish pages
            if ($this->publishPages && $obj instanceof SiteTree) {
                $obj->publish('Stage', 'Live');
            }

            // save to results
            if ($existing) {
                if ($changed) {
                    $results->addUpdated($obj);
                } else {
                    $results->addSkipped("No data was changed.");
                }
            } else {
                $results->addCreated($obj);
            }
        } catch (ValidationException $e) {
            $results->addSkipped($e->getMessage());
        }

        $objID = $obj->ID;
        // reduce memory usage
        $obj->destroy();
        unset($existingObj);
        unset($obj);
        
        return $objID;
    }
541949
protected function processFormat(array $record, string $tag): string
    {
        if (preg_match_all('/\{\{(.*?)\}\}/', $tag, $matches)) {
            foreach ($matches[1] as $match) {
                if (!isset($record[$match])) {
                    throw new \LogicException('No such field in the record');
                }
                $tag = str_replace(sprintf('{{%s}}', $match), $record[$match], $tag);
            }
        }

        return $tag;
    }
655529
function display_browse_field($recordid, $template) {
        global $DB;

        if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
            if (isset($content->content)) {
                $options = new stdClass();
                if ($this->field->param1 == '1') {  // We are autolinking this field, so disable linking within us
                    $options->filter = false;
                }
                $options->para = false;
                $str = file_rewrite_pluginfile_urls($content->content, 'pluginfile.php', $this->context->id, 'mod_data', 'content', $content->id, $this->get_options());
                $str = format_text($str, $content->content1, $options);
            } else {
                $str = '';
            }
            return $str;
        }
        return false;
    }
1102410
private function getField($columnName) {
        foreach($this->getFields() as $field) {
            if($field->getName() == $columnName) {
                return $field;
            }
        }
        echo 'Could Not Find Field '.$this->getTableName().'.'.$columnName."\n";
        return false;
    }
163658
protected function processChildRecord($record)
    {
        $id = (int)$record['uid'];
        $this->checkOptions($record);
        /* @var $recordContentObjectRenderer ContentObjectRenderer */
        $recordContentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
        $recordContentObjectRenderer->start($record, 'tt_content');
        $this->processedRecordVariables[$id] = ['data' => $record];
        if (
            (int)$this->options['recursive'] > 0 &&
            $record['CType'] === 'gridelements_pi1' &&
            !empty($record['tx_gridelements_backend_layout'])
        ) {
            $childProcessorConfiguration = $this->containerProcessorConfiguration;
            $childProcessorConfiguration['dataProcessing.']['0.'] = $this->processorConfiguration;
            $childProcessorConfiguration['dataProcessing.']['0.']['recursive'] = (int)$this->options['recursive'] - 1;
            $childProcessorConfiguration['dataProcessing.']['0'] = 'GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor';
            $this->processedRecordVariables[$id] = $this->contentDataProcessor->process(
                $recordContentObjectRenderer,
                $childProcessorConfiguration,
                $this->processedRecordVariables[$id]
            );
        } else {
            $this->processedRecordVariables[$id] = $this->contentDataProcessor->process(
                $recordContentObjectRenderer,
                $this->containerProcessorConfiguration,
                $this->processedRecordVariables[$id]
            );
        }
    }
748724
protected function columnMapRecord($record)
    {
        $adjustedmap = $this->columnMap;
        $newrecord = array();
        foreach ($record as $field => $value) {
            if (isset($adjustedmap[$field])) {
                $newrecord[$adjustedmap[$field]] = $value;
            } else {
                $newrecord[$field] = $value;
            }
        }

        return $newrecord;
    }