32 lines
938 B
PHP
32 lines
938 B
PHP
<?php
|
|
|
|
namespace App\Helpers\Equipment;
|
|
|
|
use App\Models\Equipment\SwitchModel;
|
|
|
|
class SwitchHelper extends EquipmentHelper
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->setTitleField(field: SwitchModel::TITLE);
|
|
}
|
|
|
|
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
|
{
|
|
switch ($action) {
|
|
case 'modify':
|
|
if (!$this->getMyAuth()->isAccessRole(['security'])) {
|
|
$action = $viewDatas['entity']->getCode();
|
|
} else {
|
|
$action = parent::getListButton($action, $label ? $label : $viewDatas['entity']->getCode(), $viewDatas, $extras);
|
|
}
|
|
break;
|
|
default:
|
|
$action = parent::getListButton($action, $label, $viewDatas, $extras);
|
|
break;
|
|
}
|
|
return $action;
|
|
}
|
|
}
|