// 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))
$this->toolbar_title = array($this->toolbar_title);
$title = implode(' '.Configuration::get('PS_NAVIGATION_PIPE').' ', $this->toolbar_title);
switch ($this->display)
{
case 'view':
@@ -1135,6 +1133,12 @@ class AdminControllerCore extends Controller
'href' => $back,
'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;
case 'add':
case 'edit':
@@ -1154,6 +1158,14 @@ class AdminControllerCore extends Controller
'href' => $back,
'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;
case 'options':
// 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)
&& $this->page_header_toolbar_btn instanceof Traversable
|| trim($title) != '')