Permalink
Browse files

MINOR More extension points in CMSMain (specifically to allow for 'lo…

…cale' query parameter and language drop down of the 'translatable' extension)
  • Loading branch information...
chillu committed May 15, 2012
1 parent 20af440 commit c185c737dd85cccdfb95c1b82ac5e6a0750c0165
Showing with 20 additions and 2 deletions.
  1. +18 −2 code/controllers/CMSMain.php
  2. +2 −0 templates/Includes/CMSMain_TreeView.ss
@@ -134,18 +134,24 @@ function SwitchView($page = null) {
* @return string
*/
public function Link($action = null) {
- return Controller::join_links(
+ $link = Controller::join_links(
$this->stat('url_base', true),
$this->stat('url_segment', true), // in case we want to change the segment
'/', // trailing slash needed if $action is null!
"$action"
);
+ $this->extend('updateLink', $link);
+ return $link;
}
public function LinkPages() {
return singleton('CMSPagesController')->Link();
}
+ public function LinkPagesWithSearch() {
+ return $this->LinkWithSearch($this->LinkPages());
+ }
+
public function LinkTreeView() {
return $this->LinkWithSearch(singleton('CMSMain')->Link('treeview'));
}
@@ -187,10 +193,12 @@ protected function LinkWithSearch($link) {
'q' => (array)$this->request->getVar('q'),
'ParentID' => $this->request->getVar('ParentID')
);
- return Controller::join_links(
+ $link = Controller::join_links(
$link,
array_filter(array_values($params)) ? '?' . http_build_query($params) : null
);
+ $this->extend('updateLinkWithSearch', $link);
+ return $link;
}
function LinkPageAdd() {
@@ -226,6 +234,8 @@ public function SiteTreeAsUL() {
Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
$html .= $this->getSiteTreeFor($this->stat('tree_class'));
+ $this->extend('updateSiteTreeAsUL', $html);
+
return $html;
}
@@ -235,6 +245,12 @@ public function SiteTreeAsUL() {
public function TreeIsFiltered() {
return $this->request->getVar('q');
}
+
+ public function ExtraTreeTools() {
+ $html = '';
+ $this->extend('updateExtraTreeTools', $html);
+ return $html;
+ }
function SearchForm() {
// get all page types in a dropdown-compatible format
@@ -10,6 +10,8 @@
<% _t('CMSMain.EditTree', 'Edit Tree') %>
</button>
+$ExtraTreeTools
+
<div class="center">
<% if TreeIsFiltered %>
<div class="cms-tree-filtered">

0 comments on commit c185c73

Please sign in to comment.