/** * Returns the string which will be used in the template * @return string */ public function forTemplate() { $value = parent::forTemplate(); if (FrontendEditing::editingEnabled() && FrontendEditing::isEditable($this)) { $value = '<span class="frontend-editable frontend-editable-varchar" data-feclass="' . FrontendEditing::getClassName($this) . '" data-feid="' . FrontendEditing::getID($this) . '" data-fefield="' . $this->name . '">' . $value . '</span>'; } return $value; }
public static function disableEditingFor($class) { if (in_array($class, self::$EditableClasses)) { unset(self::$EditableClasses[array_search($class, self::$EditableClasses)]); } if (empty(self::$EditableClasses)) { FrontendEditing::$ForceEditable = false; } }
/** * Returns the string which will be used in the template * @return string */ public function forTemplate() { $isEditable = FrontendEditing::editingEnabled() && FrontendEditing::isEditable($this); $value = parent::forTemplate(); if ($isEditable) { $field = $this->scaffoldSearchField($value)->setAttribute('data-feclass', FrontendEditing::getClassName($this))->setAttribute('data-feid', FrontendEditing::getID($this))->setAttribute('data-fefield', $this->name)->setHasEmptyDefault(false)->addExtraClass("frontend-editable frontend-editable-boolean")->setValue($value); $value = $field->forTemplate(); } return $value; }
/** * Returns the string which will be used in the template * @return string */ public function forTemplate() { $isEditable = FrontendEditing::editingEnabled() && FrontendEditing::isEditable($this); $value = parent::forTemplate(); if ($isEditable) { $field = $this->formField(null, null, false, $value)->setAttribute('data-feclass', FrontendEditing::getClassName($this))->setAttribute('data-feid', FrontendEditing::getID($this))->setAttribute('data-fefield', $this->name)->addExtraClass("frontend-editable frontend-editable-enum"); $value = $field->forTemplate(); } return $value; }
/** * Returns the string which will be used in the template * @return string */ public function forTemplateEdit() { $dbField = $this->owner->dbObject('Filename'); FrontendEditing::setValue($dbField, $this->owner->Filename, $this->owner); $isEditable = FrontendEditing::editingEnabled() && FrontendEditing::isEditable($dbField); $value = $this->owner->forTemplate() . "99"; if ($isEditable) { $value = "<span class='editable'>" . $value . "</span>"; } return $value; }
/** * Returns the string which will be used in the template * @return string */ public function forTemplate() { $isEditable = FrontendEditing::editingEnabled() && FrontendEditing::isEditable($this); if ($isEditable) { $this->processShortcodes = false; } $value = parent::forTemplate(); if ($isEditable) { $randId = uniqid(); $value = '<div id="' . $randId . '" contenteditable=true class="frontend-editable frontend-editable-html" data-feclass="' . FrontendEditing::getClassName($this) . '" data-feid="' . FrontendEditing::getID($this) . '" data-fefield="' . $this->name . '">' . $value . '</div>'; } return $value; }
public function feFileUploadForm(SS_HTTPRequest $request) { $feclass = $request->getVar('feclass'); $fefield = $request->getVar('fefield'); $feid = $request->getVar('feid'); $filesUpload = $request->getVar('filesUpload'); $fefileid = $request->getVar('fefileid'); $fefileclass = $request->getVar('fefileclass'); $res = false; if ($filesUpload == 1 && class_exists($fefileclass) && class_exists($feclass)) { $file = $fefileid ? $fefileclass::get()->byId($fefileid) : $fefileclass::create(); $res = FrontendEditing::getUploadForm($file, $feclass, $feid, $fefield); } return $res; }