Source of file FrontendEditorText.php
Size: 1,239 Bytes - Last Modified: 2021-12-24T06:49:02+00:00
/var/www/docs.ssmods.com/process/src/code/Fields/FrontendEditorText.php
123456789101112131415161718192021222324252627282930313233343536373839 | <?php /** * * @see https://github.com/michelsteege/silverstripe-frontend-editing */ class FrontendEditorText extends Text { /** * Set the value on the field. * Optionally takes the whole record as an argument, * to pick other values. * * @param mixed $value * @param array $record */ public function setValue($value, $record = null) { FrontendEditing::setValue($this, $value, $record); parent::setValue($value, $record); } /** * Returns the string which will be used in the template * @return string */ public function forTemplate() { $value = parent::forTemplate(); if (FrontendEditing::editingEnabled() && FrontendEditing::isEditable($this) // If this is a link, its probably in a href, so dont wrap it // Whish there was a way to tell if fields are being rendered in an HTML attribute && $this->Name !== "Link") { $value = '<span class="frontend-editable frontend-editable-text" data-feclass="'.FrontendEditing::getClassName($this).'" data-feid="'.FrontendEditing::getID($this).'" data-fefield="'.$this->name.'">'.$value.'</span>'; } return $value; } } |