// Add identifier name
This commit is contained in:
@@ -52,6 +52,7 @@ class AdminControllerCore extends Controller
|
|||||||
|
|
||||||
/** @var string Object identifier inside the associated table */
|
/** @var string Object identifier inside the associated table */
|
||||||
protected $identifier = false;
|
protected $identifier = false;
|
||||||
|
protected $identifier_name = 'name';
|
||||||
|
|
||||||
/** @var string Tab name */
|
/** @var string Tab name */
|
||||||
public $className;
|
public $className;
|
||||||
@@ -1134,10 +1135,11 @@ class AdminControllerCore extends Controller
|
|||||||
'desc' => $this->l('Back to list')
|
'desc' => $this->l('Back to list')
|
||||||
);
|
);
|
||||||
$obj = $this->loadObject(true);
|
$obj = $this->loadObject(true);
|
||||||
if (Validate::isLoadedObject($obj) && isset($obj->name) && !empty($obj->name))
|
$id_name = $this->identifier_name;
|
||||||
|
if (Validate::isLoadedObject($obj) && isset($obj->$id_name) && !empty($obj->$id_name))
|
||||||
{
|
{
|
||||||
array_pop($this->toolbar_title);
|
array_pop($this->toolbar_title);
|
||||||
$this->toolbar_title[] = is_array($obj->name) ? $obj->name[$this->context->employee->id_lang] : $obj->name;
|
$this->toolbar_title[] = is_array($obj->$id_name) ? $obj->$id_name[$this->context->employee->id_lang] : $obj->$id_name;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'add':
|
case 'add':
|
||||||
@@ -1159,11 +1161,12 @@ class AdminControllerCore extends Controller
|
|||||||
);
|
);
|
||||||
case 'edit':
|
case 'edit':
|
||||||
$obj = $this->loadObject(true);
|
$obj = $this->loadObject(true);
|
||||||
if (Validate::isLoadedObject($obj) && isset($obj->name) && !empty($obj->name))
|
$id_name = $this->identifier_name;
|
||||||
|
if (Validate::isLoadedObject($obj) && isset($obj->$id_name) && !empty($obj->$id_name))
|
||||||
{
|
{
|
||||||
array_pop($this->toolbar_title);
|
array_pop($this->toolbar_title);
|
||||||
$this->toolbar_title[] = sprintf($this->l('Edit: %s'),
|
$this->toolbar_title[] = sprintf($this->l('Edit: %s'),
|
||||||
is_array($obj->name) ? $obj->name[$this->context->employee->id_lang] : $obj->name);
|
is_array($obj->$id_name) ? $obj->$id_name[$this->context->employee->id_lang] : $obj->$id_name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'options':
|
case 'options':
|
||||||
|
|||||||
Reference in New Issue
Block a user