// General modification for view and edit title

This commit is contained in:
Jerome Nadaud
2013-11-12 11:06:20 +01:00
parent 44d1ed0982
commit 41196f3c5f
2 changed files with 16 additions and 13 deletions
+16 -2
View File
@@ -1119,8 +1119,6 @@ class AdminControllerCore extends Controller
if (!is_array($this->toolbar_title)) if (!is_array($this->toolbar_title))
$this->toolbar_title = array($this->toolbar_title); $this->toolbar_title = array($this->toolbar_title);
$title = implode(' '.Configuration::get('PS_NAVIGATION_PIPE').' ', $this->toolbar_title);
switch ($this->display) switch ($this->display)
{ {
case 'view': case 'view':
@@ -1135,6 +1133,12 @@ class AdminControllerCore extends Controller
'href' => $back, 'href' => $back,
'desc' => $this->l('Back to list') 'desc' => $this->l('Back to list')
); );
$obj = $this->loadObject();
if (Validate::isLoadedObject($obj) && isset($obj->name) && !empty($obj->name))
{
array_pop($this->toolbar_title);
$this->toolbar_title[] = is_array($obj->name) ? $obj->name[$this->context->employee->id_lang] : $obj->name;
}
break; break;
case 'add': case 'add':
case 'edit': case 'edit':
@@ -1154,6 +1158,14 @@ class AdminControllerCore extends Controller
'href' => $back, 'href' => $back,
'desc' => $this->l('Cancel') 'desc' => $this->l('Cancel')
); );
$obj = $this->loadObject();
if (Validate::isLoadedObject($obj) && isset($obj->name) && !empty($obj->name))
{
array_pop($this->toolbar_title);
$this->toolbar_title[] = sprintf($this->l('Edit: %s'),
is_array($obj->name) ? $obj->name[$this->context->employee->id_lang] : $obj->name);
}
break; break;
case 'options': case 'options':
// Default save button - action dynamically handled in javascript // Default save button - action dynamically handled in javascript
@@ -1163,6 +1175,8 @@ class AdminControllerCore extends Controller
); );
} }
$title = implode(' '.Configuration::get('PS_NAVIGATION_PIPE').' ', $this->toolbar_title);
if (is_array($this->page_header_toolbar_btn) if (is_array($this->page_header_toolbar_btn)
&& $this->page_header_toolbar_btn instanceof Traversable && $this->page_header_toolbar_btn instanceof Traversable
|| trim($title) != '') || trim($title) != '')
@@ -168,17 +168,6 @@ class AdminCategoriesControllerCore extends AdminController
'desc' => $this->l('Add new category'), 'desc' => $this->l('Add new category'),
'icon' => 'process-icon-new' 'icon' => 'process-icon-new'
); );
if ($this->display == 'view')
{
array_pop($this->toolbar_title);
$obj = $this->loadObject();
if (Validate::isLoadedObject($obj))
$this->toolbar_title[] = $obj->name[$this->context->employee->id_lang];
$this->page_header_toolbar_title = implode(' '.Configuration::get('PS_NAVIGATION_PIPE').' ', $this->toolbar_title);
}
} }
public function initContent() public function initContent()