first commit
This commit is contained in:
35
bundles/KupShop/AdminBundle/Util/WindowTabLocator.php
Normal file
35
bundles/KupShop/AdminBundle/Util/WindowTabLocator.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user