/** * Return the form's action attribute. * This is build by adding an executeForm get variable to the parent controller's Link() value * * @return string */ public function FormAction() { if ($this->formActionPath) { return $this->formActionPath; } elseif ($this->controller->hasMethod("FormObjectLink")) { return $this->controller->FormObjectLink($this->name); } else { return Controller::join_links($this->controller->Link(), $this->name); } }
public function Link() { return Controller::join_links($this->parentController->Link(), $this->urlSegment); }
public function forTemplate() { return sprintf('<div id="cms-editor-dialogs" data-url-linkform="%s" data-url-mediaform="%s"></div>', Controller::join_links($this->controller->Link(), $this->name, 'LinkForm', 'forTemplate'), Controller::join_links($this->controller->Link(), $this->name, 'MediaForm', 'forTemplate')); }
/** * Adds extra fields to this form * * @param FieldList $fields * @param Controller $controller * @param string $name * @param array $context */ public function updateFormFields(FieldList &$fields, Controller $controller, $name, $context = []) { // Add preview link if (empty($context['Record'])) { return; } $record = $context['Record']; if ($record->hasExtension(Versioned::class)) { $link = $controller->Link('preview'); $fields->unshift(new LiteralField("PreviewLink", sprintf('<a href="%s" rel="external" target="_blank">Preview</a>', Convert::raw2att($link)))); } }