Skip to content

Instantly share code, notes, and snippets.

@ajshort
Created October 6, 2009 05:38
Show Gist options
  • Select an option

  • Save ajshort/202791 to your computer and use it in GitHub Desktop.

Select an option

Save ajshort/202791 to your computer and use it in GitHub Desktop.
@@ -41,10 +41,20 @@ class ContentController extends Controller {
$this->dataRecord = $dataRecord;
$this->failover = $this->dataRecord;
parent::__construct();
}
+ /**
+ * Return the link to this controller, but force the expanded link to be returned so that form methods and
+ * similar will function properly.
+ *
+ * @return string
+ */
+ public function Link($action = null) {
+ return $this->data()->Link(($action ? $action : true));
+ }
+
//----------------------------------------------------------------------------------//
// These flexible data methods remove the need for custom code to do simple stuff
/**
* Return the children of a given page. The parent reference can either be a page link or an ID.
@@ -695,11 +695,11 @@ class Form extends RequestHandler {
if ($this->formActionPath) {
return $this->formActionPath;
} elseif($this->controller->hasMethod("FormObjectLink")) {
return $this->controller->FormObjectLink($this->name);
} else {
- return $this->controller->Link($this->name);
+ return Controller::join_links($this->controller->Link(), $this->name);
}
}
/** @ignore */
private $formActionPath = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment