36 lines
759 B
PHP
36 lines
759 B
PHP
<?php
|
|
|
|
namespace KupShop\AdminBundle\Util;
|
|
|
|
use Symfony\Component\DependencyInjection\ServiceLocator;
|
|
|
|
class WindowTabLocator
|
|
{
|
|
private $locator;
|
|
private $tabs;
|
|
|
|
public function __construct(ServiceLocator $locator, array $tabs)
|
|
{
|
|
$this->locator = $locator;
|
|
$this->tabs = $tabs;
|
|
}
|
|
|
|
public function getTabs($type)
|
|
{
|
|
if (!isset($this->tabs[$type])) {
|
|
return [];
|
|
}
|
|
|
|
$tabs = [];
|
|
foreach ($this->tabs[$type] as $class => $priority) {
|
|
if ($this->locator->has($class)) {
|
|
if ($this->locator->get($class)->isVisible()) {
|
|
$tabs[] = $this->locator->get($class);
|
|
}
|
|
}
|
|
}
|
|
|
|
return $tabs;
|
|
}
|
|
}
|