2021-10-08 16:57:38 +02:00
|
|
|
<?php
|
|
|
|
use Cake\Routing\Router;
|
2022-02-07 10:48:55 +01:00
|
|
|
use Cake\ORM\TableRegistry;
|
|
|
|
|
|
|
|
$this->userSettingsTable = TableRegistry::getTableLocator()->get('UserSettings');
|
2021-10-08 16:57:38 +02:00
|
|
|
|
|
|
|
$seed = 'sb-' . mt_rand();
|
|
|
|
$icon = $entry['icon'] ?? '';
|
|
|
|
$label = $entry['label'] ?? '';
|
|
|
|
$name = $entry['name'] ?? '';
|
|
|
|
$active = false;
|
|
|
|
|
|
|
|
$url = $entry['url'];
|
|
|
|
|
|
|
|
$currentURL = Router::url(null);
|
|
|
|
if ($url == $currentURL) {
|
|
|
|
$active = true;
|
|
|
|
}
|
|
|
|
|
2022-02-07 10:48:55 +01:00
|
|
|
$validURI = $this->userSettingsTable->validURI($url);
|
|
|
|
|
2021-10-08 16:57:38 +02:00
|
|
|
echo $this->Bootstrap->button([
|
|
|
|
'nodeType' => 'a',
|
|
|
|
'text' => h($label),
|
|
|
|
'title' => h($name),
|
|
|
|
'variant' => 'dark',
|
|
|
|
'outline' => !$active,
|
|
|
|
'size' => 'sm',
|
|
|
|
'icon' => h($icon),
|
2022-02-07 10:48:55 +01:00
|
|
|
'class' => ['mb-1', !$validURI ? 'disabled' : ''],
|
2022-11-24 12:50:11 +01:00
|
|
|
'attrs' => [
|
2022-02-07 10:48:55 +01:00
|
|
|
'href' => $validURI ? h($url) : '#',
|
2021-10-08 16:57:38 +02:00
|
|
|
]
|
|
|
|
]);
|
|
|
|
?>
|