| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace ThurData\Servers\KerioEmail\Core\Http\View;
- /**
- * Description of Breadcrumb
- *
- * @author Rafał Ossowski <rafal.os@thurdata.com>
- */
- class Breadcrumb
- {
- /**
- * @var array
- */
- protected $data = [];
- public function __construct()
- {
-
- }
- public function load(array $menu = [], $controller = null, $action = null, array $arrayBreadcrumb = [])
- {
- if (empty($controller))
- {
- $controller = key($menu);
- }
- if ($controller)
- {
- $this->data[] = [
- 'name' => $controller,
- 'url' => $menu[strtolower($controller)]['url'] ? : $menu[$controller]['url'],
- 'icon' => $menu[strtolower($controller)]['icon'] ? : $menu[$controller]['icon']
- ];
- }
- if ($arrayBreadcrumb)
- {
- $count = count($arrayBreadcrumb) - 1;
- foreach ($arrayBreadcrumb as $number => $breadcrumb)
- {
- $this->data[] = [
- 'name' => $breadcrumb->getName(),
- 'url' => $breadcrumb->isUrl() && $count != $number ? $breadcrumb->getUrl() : null,
- 'icon' => $breadcrumb->isIcon() ? $breadcrumb->getIcon() : null
- ];
- }
- }
- elseif ($action && $action !== 'index')
- {
- $this->data[] = [
- 'name' => $action,
- 'url' => $menu[$controller]['submenu'][$action]['url'],
- 'icon' => $menu[$controller]['submenu'][$action]['icon']
- ];
- }
- return $this;
- }
- /**
- * @return array
- */
- public function get()
- {
- return $this->data;
- }
- }
|