fillFromConfig([ 'readOnly', 'recordUrl', 'recordOnClick', 'relation', ]); if (!isset($this->readOnly) && $this->config->previewMode) { $this->readOnly = $this->config->previewMode; } } public function render() { if (!$this->controller->isClassExtendedWith(\Backend\Behaviors\RelationController::class)) { $error = Lang::get('backend::lang.relation.missing_behavior', [ 'field' => $this->formField->fieldName, 'controller' => get_class($this->controller), ]); throw new SystemException($error); } $options = []; if (!is_null($this->readOnly)) { $options['readOnly'] = $this->readOnly; } if (!is_null($this->recordUrl)) { $options['recordUrl'] = $this->recordUrl; } if (!is_null($this->recordOnClick)) { $options['recordOnClick'] = $this->recordOnClick; } $relation = $this->relation ?: $this->formField->fieldName; return $this->controller->relationRender($relation, $options); } public function getSaveValue($value) { return FormField::NO_SAVE_DATA; } }