@DI\Observe("claroline_group_additional_action")

@param \Claroline\CoreBundle\Menu\GroupAdditionalActionEvent $event
327570
public function onGroupActionMenuRender(GroupAdditionalActionEvent $event)
    {
        $group = $event->getGroup();
        $url = $this->router->generate(
            'claro_tag_group_tag_form',
            array('group' => $group->getId())
        );

        $menu = $event->getMenu();
        $menu->addChild(
            $this->translator->trans('tag_action', array(), 'tag'),
            array('uri' => $url)
        )->setExtra('icon', 'fa fa-tags')
        ->setExtra('display', 'modal_form');

        return $menu;
    }
91684
public function addAdditionalInfo(\AgentSIB\Diadoc\Api\Proto\Invoicing\AdditionalInfo $value)
    {
        if ($this->AdditionalInfo === null) {
            $this->AdditionalInfo = new \Protobuf\MessageCollection();
        }

        $this->AdditionalInfo->add($value);
    }
1368299
protected function dispatch($eventName, Event $event = null)
    {
        if ($event == null) {
            $event = new DefaultActionEvent();
        }

        $this->getDispatcher()->dispatch($eventName, $event);
    }
355147
public function addGroup(EventInterface $event) {
        $accessControl = $event->getAccessControl();
        if (!($accessControl instanceof MutableAdapterInterface)) {
            throw new ResourceException('Access control adapter is immutable', 405);
        }

        $request = $event->getRequest();
        $route = $request->getRoute();
        $groupName = $route->get('group');

        $group = $accessControl->getGroup($groupName);
        $groupExists = !empty($group);

        $resources = json_decode($request->getContent(), true);

        if (!is_array($resources)) {
            throw new ResourceException('Invalid data. Array of resource strings is expected', 400);
        }

        foreach ($resources as $resource) {
            if (!is_string($resource)) {
               throw new ResourceException('Invalid value in the resources array. Only strings are allowed', 400);
            }
        }

        if ($groupExists) {
            $accessControl->updateResourceGroup($groupName, $resources);
        } else {
            $accessControl->addResourceGroup($groupName, $resources);
        }

        $response = $event->getResponse();
        $response->setStatusCode($groupExists ? 200 : 201);
    }
950414
protected function performAdditionalUpdateAction($updateEvent)
    {
        // Associate the file if it's a virtual product
        // and with only 1 PSE
        $virtualDocumentId = \intval($updateEvent->getVirtualDocumentId());

        if ($virtualDocumentId >= 0) {
            $defaultPSE = ProductSaleElementsQuery::create()
                ->filterByProductId($updateEvent->getProductId())
                ->filterByIsDefault(true)
                ->findOne();

            if (null !== $defaultPSE) {
                if ($virtualDocumentId !== 0) {
                    $assocEvent = new MetaDataCreateOrUpdateEvent('virtual', MetaData::PSE_KEY, $defaultPSE->getId(), $virtualDocumentId);
                    $this->dispatch(TheliaEvents::META_DATA_UPDATE, $assocEvent);
                } else {
                    $assocEvent = new MetaDataDeleteEvent('virtual', MetaData::PSE_KEY, $defaultPSE->getId());
                    $this->dispatch(TheliaEvents::META_DATA_DELETE, $assocEvent);
                }
            }
        }

        return null;
    }
114819
public function execute(Observer $observer) {
        $data           = $this->readDataArgument($observer);
        $additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);

        if (!is_array($additionalData)) {
            return;
        }

        $paymentInfo = $this->readPaymentModelArgument($observer);

        foreach (self::$additionalInformationList as $additionalInformationKey) {
            if( array_key_exists($additionalInformationKey, $additionalData) ) {
                $paymentInfo->setAdditionalInformation($additionalInformationKey, $additionalData[$additionalInformationKey]);
            }
        }
    }
543278
public function onSiteResourceEventAlterChannels(Event $event)
    {
        if (!$this->groupManager || !$event instanceof ResourceEvent) {
            return;
        }

        $done = [];

        // Fetch site groups, and yes we don't really have a choice here
        $sites = $this->siteManager->getStorage()->loadAll($event->getResourceIdList(), false);
        foreach ($sites as $site) {
            $groupId = (int)$site->getGroupId();
            if ($groupId) {
                $done[$groupId] = $groupId;
            }
        }

        foreach ($done as $groupId) {
            $event->addArbitraryChanId('admin:site:' . $groupId);
        }
    }
279409
public function handleAddToUrl(AddToUrlEvent $event)
    {
        /** @var Controller $controllerAdapter */
        $controllerAdapter = $this->framework->getAdapter(Controller::class);

        $event->setUrl($controllerAdapter->addToUrl($event->getSuffix()));
    }
96501
public function addDefaultCustomerGroupToCustomer(CustomerEvent $event)
    {
        $defaultCustomerGroup = CustomerGroupQuery::create()->findOneByIsDefault(true);
        if (null === $defaultCustomerGroup) {
            return;
        }

        (new CustomerCustomerGroupQuery())
            ->filterByCustomerId($event->getCustomer()->getId())
            ->filterByCustomerGroupId($defaultCustomerGroup->getId())
            ->findOneOrCreate()
            ->save();
    }
567578
protected function performAdditionalDeleteAction($deleteEvent)
    {
        if ($deleteEvent->getProductCount() > 0) {
            $this->getParserContext()->setGeneralError(
                $this->getTranslator()->trans(
                    "This template is in use in some of your products, and cannot be deleted. Delete it from all your products and try again."
                )
            );

            return $this->renderList();
        }

        // Normal delete processing
        return null;
    }
429346
public function onExternalAuthenticationMenuConfigure(ConfigureMenuEvent $event)
    {
        $name = $this->translator->trans('external_user_group_parameters', [], 'claro_external_user_group');
        $menu = $event->getMenu();
        $menu->addChild(
            $name,
            [
                'route' => 'claro_admin_external_sync_config_index',
            ]
        )->setExtra('name', $name);

        return $menu;
    }
658502
public function handlePersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$event->getOption('auto_name') || !$document instanceof AutoNameBehavior || $event->hasNode()) {
            return;
        }

        $parentNode = $event->getParentNode();
        $name = $this->getName($document, $parentNode, $event->getOption('auto_rename'));
        $node = $parentNode->addNode($name);
        $event->setNode($node);
    }
1001697
public function subscribe(EventInterface $event) {
        $resources = Resource::getAllResources();

        if ($this->params['additionalResources']) {
            $resources = array_merge($resources, $this->params['additionalResources']);
        }

        $events = [];
        foreach ($resources as $resource) {
            $events[$resource] = ['checkAccess' => 500];
        }

        $manager = $event->getManager();
        $manager->addCallbacks($event->getHandler(), $events);
    }
213006
public function onAdd(OrderItemEvent $event)
    {
        $order = $event->getOrder();
        $item  = $event->getItem();

        $order->addItem($item);
    }
1299185
public static function event_triggered(\core\event\base $event) {
        if (self::$eventsink) {
            self::$eventsink->add_event($event);
        }
    }
157187
public function onUserActionMenuRender(UserAdditionalActionEvent $event)
    {
        $user = $event->getUser();
        $url = $this->router->generate(
            'claro_tag_user_tag_form',
            array('user' => $user->getId())
        );

        $menu = $event->getMenu();
        $menu->addChild(
            $this->translator->trans('tag_action', array(), 'tag'),
            array('uri' => $url)
        )->setExtra('icon', 'fa fa-tags')
        ->setExtra('display', 'modal_form');

        return $menu;
    }
513672
private function isAdminException(GetResponseForExceptionEvent $event): bool
    {
        $request = $event->getRequest();

        /** @var SiteAccess $siteAccess */
        $siteAccess = $request->get('siteaccess', new SiteAccess());

        return in_array($siteAccess->name, $this->siteAccessGroups[EzPlatformAdminUiBundle::ADMIN_GROUP_NAME]);
    }