Define the current action according to the routing configuration.

@param AdminEvent $event

@throws Exception
968646
public function handleRequest(AdminEvent $event)
    {
        $actionName = $event->getRequest()->get('_action');

        if (null === $actionName) {
            throw new Exception('The _action was not found in the request');
        }
        $admin = $event->getAdmin();
        $action = $this->actionFactory->create($actionName, $admin->getName(), $admin->getConfiguration());

        $event->setAction($action);
    }
31907
public function handle($event)
    {
        if ($event instanceof RouteMatched) {
            $this->handleLaravelRoute($event);
        }

        if ($event instanceof GzeroRouteMatched) {
            $this->handleRoute($event);
        }
    }
467700
public function handleAction(ActionEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $this->checkLanguage($event->getEnvironment(), 'create' === $event->getAction()->getName());
    }
741006
public function onKernelController(FilterControllerEvent $event): void
    {
        $controller = $event->getController();
        if (\is_array($controller)) {
            [$controller] = $controller; // Ignoring action
        }
        if (!$controller instanceof AdminInjectableInterface && !$controller instanceof ActionInjectableInterface) {
            return;
        }

        $request = $event->getRequest();
        if (!$request->attributes->has('_admin')) {
            $routeName = $request->attributes->get('_route');

            $m = "Missing request attribute '_admin' for route {$routeName}, this means you declared";
            $m .= ' this route outside the admin configuration, please use the admin configuration';
            throw new \LogicException($m);
        }
        $admin = $request->attributes->get('_admin');
        if (!$admin instanceof Admin) {
            throw new \UnexpectedValueException('_admin request attribute is not an Admin object');
        }
        if ($controller instanceof AdminInjectableInterface) {
            $controller->setAdmin($admin);
        }

        if (!$request->attributes->has('_action')) {
            $routeName = $request->attributes->get('_route');

            $m = "Missing request attribute '_action' for route {$routeName},";
            $m .= 'this means you declared this route outside the admin configuration, please include the _action';
            $m .= 'attribute in your route definition or use the admin configuration';
            throw new \LogicException($m);
        }
        $admin->setCurrentAction($request->attributes->get('_action'));
        if ($controller instanceof ActionInjectableInterface) {
            $controller->setAction($admin->getCurrentAction());
        }
    }
1050611
public function onRequestBeforeSend(Event $event)
    {
        if (!strlen($this->config['access_token'])) {
          return;
        }

        switch ($this->config['authorize_location']) {
          case 'query':
            $event['request']->getQuery()->set(
              $this->config['query_param_key'],
              $this->config['access_token']
            );
            break;

          default:
            $authorizationParams = array(
                'access_token'     => $this->config['access_token'],
                'token_type'       => $this->config['token_type'],
            );

            $event['request']->setHeader(
                'Authorization',
                $this->buildAuthorizationHeader($authorizationParams)
            );
            break;
        }
    }
826734
public function runEvent($event)
    {
        $this->line('<info>Running scheduled command:</info> '.$event->getSummaryForDisplay());
        $event->run($this->laravel);
        $this->eventsRan = true;
    }
1310723
private function fireEvent($event)
    {
        $env = $this->formatEventName($event);

        if (emitter()->bound($env)) {
            emitter()->emit($env, $this);
        }
    }
108024
public function handle(RouteMatched $event)
    {
        $this->tracker->trackMatchedRoute($event->route, $event->request);
    }
745720
public function startup(Event $Event) {
		$Controller = $Event->subject();
		$this->Controller = $Controller;
		if (!empty($this->_config['actions'])) {
			if (in_array($this->Controlle->action, $this->_config['actions'])) {
				if ($this->_config['checkHash'] === true) {
					$this->checkHash();
				}
				$this->unpackParams();
			}
		}
	}
1368299
protected function dispatch($eventName, Event $event = null)
    {
        if ($event == null) {
            $event = new DefaultActionEvent();
        }

        $this->getDispatcher()->dispatch($eventName, $event);
    }
173117
public static function run(Event $event)
    {
        $event->getIO()->write('<info>Now running setup tasks...</info>');
        $config = static::getConfig($event);
        $tasks  = static::getSetupTasks($event);
        foreach ($tasks as $task) {
            /** @var SetupTask $taskStep */
            $taskStep = new $task($config, $event);
            $event->getIO()->write(
                sprintf(
                    '<info>Task %1$s</info>',
                    $taskStep->getName()
                )
            );
            $taskStep->complete();
        }
        $event->getIO()->write('<info>Setup tasks complete, cleaning up...</info>');
    }
1080037
public function beforeRender(Event $event)
    {
        if ($this->_controller()->getName() === 'Error') {
            return;
        }

        if (!empty($event->getSubject()->entity)) {
            $this->_entity = $event->getSubject()->entity;
        }

        if ($this->associations === null) {
            $this->associations = $this->_associations(array_keys($this->_getRelatedModels()));
        }

        $this->ensureConfig();

        $this->beforeRenderFormType();
        $this->beforeRenderIndexType();
        $this->beforeRenderSiteTitle();
        $this->beforeRenderUtilityNavigation();
        $this->beforeRenderSidebarNavigation();

        $controller = $this->_controller();
        $controller->set('actionConfig', $this->_action()->getConfig());
        $controller->set('title', $this->_getPageTitle());
        $controller->set('breadcrumbs', $this->_getBreadcrumbs());

        $associations = $this->associations;
        $controller->set(compact('associations'));

        $fields = $this->_scaffoldFields($associations);
        $controller->set('fields', $fields);
        $controller->set('formTabGroups', $this->_getFormTabGroups($fields));

        $controller->set('blacklist', $this->_blacklist());
        $controller->set('actions', $this->_getControllerActions());
        $controller->set('bulkActions', $this->_getBulkActions());
        $controller->set('viewblocks', $this->_getViewBlocks());
        $controller->set('actionGroups', $this->_getActionGroups());
        $controller->set($this->_getPageVariables());
    }
830481
protected function fireEvent($event)
    {
        $this->app['events']->fire(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]);
    }
535493
public function handleForm(FormEvent $event): void
    {
        $admin = $event->getAdmin();
        $action = $admin->getAction();

        if ('delete' === $action->getName()) {
            if (!$admin->hasForm('delete')) {
                return;
            }
            $form = $admin->getForm('delete');
            $this->handleDeleteForm($event->getRequest(), $form, $admin);
        }
    }
1329317
public function setTaskAsNotDone(Event $event)
    {
        $this->checkPermission($event);
        if (!$event->isTaskDone()) {
            throw new \Exception('This task is already mark as not done.');
        }

        $event->setIsTaskDone(false);
        $om = $this->getDoctrine()->getManager();
        $om->flush();

        return new Response();
    }
600885
public function checkIsOnAdmin(MvcEvent $e)
    {
        /** @var $matches \Zend\Mvc\Router\Http\RouteMatch */
        $matches = $e->getRouteMatch();
    	if (!$matches instanceof Router\RouteMatch){
            throw new \Exception('No Route Matched Found, Make sure for the event priority!');
    	}
    	
    	$matchedRouteName = $matches->getMatchedRouteName();
        if (($slashOcurr = strpos($matchedRouteName, '/')) !== false) {
            // we are on one of child roots of admin
            $matchedRouteName = substr($matchedRouteName, 0, $slashOcurr);
        }

    	if ($matchedRouteName !== \yimaAdminor\Module::ADMIN_ROUTE_NAME) {
            // we are not in admin route
    		return false;
    	}

        // set Share Services flag
        self::$isOnAdmin = true;

        return true;
    }
12042
protected function doSendEvent(Event $event): void
    {
        if (!$this->shouldUseGearman()) {
            $this->locator->getEventBus()->receiveEvent($event);
            return;
        }

        $envelope = new TransportEnvelope($event, 'php');
        $channel = $this->router->forEvent($event);

        try {
            $client = $this->getClient();
            @$client->doBackground($channel, $envelope->toString(), (string)$event->get('event_id'));
            $this->validateReturnCode($client, $channel);
        } catch (\GearmanException $ge) {
            if (isset(self::$reconnectCodes[$ge->getCode()])) {
                $this->destroyClient();
                $this->locator->getEventBus()->receiveEvent($event);
                return;
            }

            throw $ge;
        } catch (\Throwable $e) {
            throw $e;
        }
    }