@param \Sonata\AdminBundle\Admin\AdminInterface $admin
@param string                                   $adminCode

@return bool
10126
public function isAdminActive(AdminInterface $admin, $adminCode = '')
    {
        $active = false;
        if ($adminCode == $admin->getCode()) {
            $active = true;
        }

        if (method_exists($admin, 'getSubNavLinks')) {
            foreach ($admin->getSubNavLinks() as $value) {
                if ($value instanceof AdminInterface) {
                    if ($value->getCode() == $adminCode) {
                        $active = true;
                    }
                }
            }
        }

        return $active;
    }
1336956
public function createActionConfiguration(
        string $actionName,
        array $configuration,
        string $adminName,
        AdminConfiguration $adminConfiguration
    ): ActionConfiguration {
        $event = new ConfigurationEvent(
            $actionName,
            $adminConfiguration->getParameter('actions'),
            $adminName,
            $adminConfiguration->getParameter('entity')
        );
        $this->eventDispatcher->dispatch(Events::CONFIGURATION_ACTION, $event);

        $resolver = new OptionsResolver();
        $actionConfiguration = new ActionConfiguration($actionName, $adminName, $adminConfiguration);
        $actionConfiguration->configureOptions($resolver);
        $actionConfiguration->setParameters($resolver->resolve($configuration));

        return $actionConfiguration;
    }
936314
public function add(AdminTab ...$adminTabs)
    {
        $this->adminTabs = array_unique(
            array_merge($this->adminTabs, $adminTabs),
            SORT_REGULAR
        );
    }
1064928
protected function _authorizeRemoveAdmin(AnCommandContext $context)
    {
        if ($this->_entity->isAdministrable()) {
            return ($this->_entity->administratorIds->count() >= 2);
        }

        return false;
    }
723234
public function isAdminGroupActive(array $group, $adminCode = '')
    {
        $active = false;
        /** @var AdminInterface $admin */
        foreach ($group['items'] as $admin) {
            if ($admin->getCode() == $adminCode) {
                $active = true;
                break;
            }
        }

        return $active;
    }
726208
public function setAdmin(string $admin = "F") : CNabuDataObject
    {
        if ($admin === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$admin")
            );
        }
        $this->setValue('nb_user_group_member_admin', $admin);
        
        return $this;
    }
181227
protected function createAdminServiceDefinition($code, array $adminConfiguration, ContainerBuilder $container): void
    {
        $adminConfiguration = array_merge(['action_class' => $this->globalConfig['action_class']], $adminConfiguration);

        $definition = new Definition(
            $this->globalConfig['admin_class'],
            [
                $code,
                $adminConfiguration,
            ]
        );
        $definition->addTag('sidus.admin');
        $definition->setPublic(false);
        $container->setDefinition('sidus_admin.admin.'.$code, $definition);
    }
962725
public function addAdministrationCommands()
    {
        $entity = $this->getController()->getItem();

        if ($entity->isOwnable() && $entity->owner->authorize('administration')) {
            if ($entity->isEnablable()) {
                $this->addCommand('enable');
            }

            if ($entity->isCommentable()) {
                $this->addCommand('commentstatus');
            }
        }
    }
834932
public function scopeAdmins($query, $paginate = false)
    {
        if ($paginate) {
            return $query->where('ticketit_admin', '1')->paginate($paginate, ['*'], 'admins_page');
        } else {
            return $query->where('ticketit_admin', '1')->get();
        }
    }
1109764
public function getAvailableFormats(AdminInterface $admin): array
    {
        $adminExportFormats = $admin->getExportFormats();

        // NEXT_MAJOR : compare with null
        if ($adminExportFormats !== ['json', 'xml', 'csv', 'xls']) {
            return $adminExportFormats;
        }

        return $this->exporter->getAvailableFormats();
    }
263923
public static function registerAdminClass(string $name, string $class): bool
    {
        if (class_exists($class) === false) {
            return false;
        }
        if (self::$admin_classes === null) {
            self::$admin_classes = [];
        }
        $check = new ReflectionClass($class);
        if ($check->implementsInterface("TheCMSThread\\Classes\\Admin") === true) {
            self::$admin_classes[$name] = $class;
            return true;
        } else {
            return false;
        }
    }
1200739
protected function getEntityClassName(AdminInterface $admin, $elements)
    {
        $element = array_shift($elements);
        $associationAdmin = $admin->getFormFieldDescription($element)->getAssociationAdmin();
        if (0 === \count($elements)) {
            return $associationAdmin->getClass();
        }

        return $this->getEntityClassName($associationAdmin, $elements);
    }
762200
public static function adminNotices( $callback, $priority = null, $accepted_args = null ) {
		self::action( 'admin_notices', $callback, $priority, $accepted_args );
	}
199956
public function register()
    {
        $this->registerCommands();

        $this->app->singleton(AdminInterface::class, function () {
            return new Admin($this->nodes(), $this->navigation(), $this->app, $this->app->make(Route::class));
        });

        //$this->app->singleton(ModelRouterInterface::class, ModelRouter::class);
        $this->app->singleton(NodeModelConfigurationInterface::class, NodeModelConfiguration::class);
        $this->app->singleton(FormManagerInterface::class, FormTable::class);
        $this->app->singleton(TableInterface::class, DataTable::class);
        $this->app->singleton(ComponentManagerBuilderInterface::class, ComponentManagerBuilder::class);
        $this->app->singleton(TabsInterface::class, Tabs::class);
        $this->app->singleton(UploadFileInterface::class, UploadFile::class);
        $this->app->singleton(ChildRowsInterface::class, ChildRows::class);
        $this->app->singleton(ActionTableInterface::class, ActionTable::class);

    }
767183
public function removeSideMenuItem($owner, $code, $sideCode)
    {
        $itemKey = $this->makeItemKey($owner, $code);
        if (!isset($this->items[$itemKey])) {
            return false;
        }

        $mainItem = $this->items[$itemKey];
        unset($mainItem->sideMenu[$sideCode]);
    }
372240
public function getCollection(AdminInterface $admin, array $filters = [])
    {
        $adminConfiguration = $admin->getConfiguration();
        $actionConfiguration = $admin->getAction()->getConfiguration();

        // Create a query builder for the configured entity class
        $queryBuilder = $this
            ->getRepository($adminConfiguration->getParameter('entity'))
            ->createQueryBuilder('entity')
        ;

        // Dispatch an event to allow filter alteration on the query builder
        $event = new ORMFilterEvent($queryBuilder, $admin, $filters);
        $this->eventDispatcher->dispatch(Events::DOCTRINE_ORM_FILTER, $event);

        if ('pagerfanta' === $actionConfiguration->getParameter('pager')) {
            $pageParameter = $actionConfiguration->getParameter('page_parameter');
            $request = $this->requestStack->getCurrentRequest();
            $page = (int) $request->get($pageParameter, 1);

            $adapter = new DoctrineORMAdapter($queryBuilder);
            $pager = new Pagerfanta($adapter);
            $pager->setCurrentPage($page);
            $pager->setMaxPerPage($actionConfiguration->getParameter('max_per_page'));
            $entities = $pager;
        } else {
            $entities = $queryBuilder->getQuery()->getResult();
        }

        return $entities;
    }
864178
private function getAdmin(string $adminCode): AdminInterface
    {
        $admin = $this->container->get($adminCode);
        if ($admin instanceof AdminInterface) {
            return $admin;
        }

        throw new ServiceNotFoundException($adminCode);
    }