コード例 #1
0
 /**
  * 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);
     }
 }
コード例 #2
0
 public function Link()
 {
     return Controller::join_links($this->parentController->Link(), $this->urlSegment);
 }
コード例 #3
0
 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'));
 }
コード例 #4
0
 /**
  * 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))));
     }
 }