Skip to content

Commit

Permalink
Merge pull request unclecheese#44 from drzax/development
Browse files Browse the repository at this point in the history
BUGFIX: Pay better attention to the locale on Translatable sites
  • Loading branch information
unclecheese committed Mar 23, 2012
2 parents a8ab61a + 34ecc6e commit cf39516
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions code/DataObjectManager.php
Expand Up @@ -264,7 +264,11 @@ public function getQueryString($params = array())
$sort_dir = isset($params['sort_dir'])? $params['sort_dir'] : $this->sort_dir;
$filter = isset($params['filter'])? $params['filter'] : $this->filter;
$search = isset($params['search'])? $params['search'] : $this->search;
return "ctf[{$this->Name()}][start]={$start}&ctf[{$this->Name()}][per_page]={$per_page}&ctf[{$this->Name()}][showall]={$show_all}&ctf[{$this->Name()}][sort]={$sort}&ctf[{$this->Name()}][sort_dir]={$sort_dir}&ctf[{$this->Name()}][search]={$search}&ctf[{$this->Name()}][filter]={$filter}";

// Restrict to the current locale if the DataObject is Translatable
$locale = (Translatable::is_enabled()) ? 'locale=' . Translatable::get_current_locale() . '&' : '';

return "{$locale}ctf[{$this->Name()}][start]={$start}&ctf[{$this->Name()}][per_page]={$per_page}&ctf[{$this->Name()}][showall]={$show_all}&ctf[{$this->Name()}][sort]={$sort}&ctf[{$this->Name()}][sort_dir]={$sort_dir}&ctf[{$this->Name()}][search]={$search}&ctf[{$this->Name()}][filter]={$filter}";
}

public function getSetting($setting)
Expand Down Expand Up @@ -477,7 +481,7 @@ public function PaginatedLink()
}

public function AddLink() {
return Controller::join_links($this->BaseLink(), 'add');
return Controller::join_links($this->BaseLink(), 'add', ((Translatable::is_enabled()) ? '?locale=' . Translatable::get_current_locale() : ''));
}

public function ShowAll()
Expand Down

0 comments on commit cf39516

Please sign in to comment.