postDispatch example



        $this->preDispatch();

        if ($this->Request()->isDispatched() && !$this->Response()->isRedirect()) {
            $action_name = $this->Front()->Dispatcher()->getFullActionName($this->Request());

            if (!$event = Shopware()->Events()->notifyUntil(__CLASS__ . '_' . $action_name$args)) {
                $this->$action(...$this->getActionArguments($action));
            }

            $this->postDispatch();
        }

        // Fire "Secure"-PostDispatch-Events only if:         // - Request is Dispatched         // - Response in no Exception         // - View has template         if ($this->Request()->isDispatched()
            && !$this->Response()->isException()
            && $this->View()->hasTemplate()
        ) {
            Shopware()->Events()->notify(
                
throw new Enlight_Controller_Exception(sprintf('Cannot find element with id %d of type \'%s\'', $id$this->type->getInternalName()));
        }

        $item = current($result->items);

        $this->View()->assign('sItem', $item);
        $this->View()->assign('sBreadcrumb', $this->getBreadcrumb($item));
    }

    public function postDispatch()
    {
        parent::postDispatch();

        $this->View()->assign('sType', $this->type);
        $this->View()->assign('sFields', $this->getFields());
        $this->View()->assign('sAction', $this->Request()->getActionName());
        $this->View()->assign('sTitleKey', $this->type->getViewTitleFieldName());
        $this->View()->assign('sMetaTitleKey', $this->type->getViewMetaTitleFieldName());
        $this->View()->assign('sDescriptionKey', $this->type->getViewDescriptionFieldName());
        $this->View()->assign('sMetaDescriptionKey', $this->type->getViewMetaDescriptionFieldName());
        $this->View()->assign('sImageKey', $this->type->getViewImageFieldName());

        if (!$this->View()->templateExists($this->View()->Template()->template_resource)) {
            
$this->View()->Engine()->setCompileId($this->View()->Engine()->getCompileId() . '_' . $this->Request()->getControllerName());
    }

    public function indexAction(): void
    {
        parent::indexAction();
        $this->View()->loadTemplate('backend/content_type/app.js');
    }

    public function postDispatch(): void
    {
        parent::postDispatch();

        if (\in_array(strtolower($this->Request()->getActionName())['index', 'load', 'extends'])) {
            $this->View()->assign('controllerName', $this->Request()->getControllerName());
            $this->View()->assign('modelFields', $this->extjsBuilder->buildModelFields($this->type));
            $this->View()->assign('listColumns', $this->extjsBuilder->buildColumns($this->type));
            $this->View()->assign('detailFields', $this->extjsBuilder->buildFieldSets($this->type));
            $this->View()->assign('type', $this->type);
        }
    }

    public function listAction(int $start = 0, int $limit = 20, array $sort = [], array $filter = []): void
    {


    /** * If the requested action is meant to be password verified, unset the session flag in order * for it not to persist in other requests. In this way, the password verification process will be triggered * again. * * @see Shopware_Controllers_Backend_Login::validatePasswordAction() */
    public function postDispatch()
    {
        parent::postDispatch();

        $calledAction = $this->Request()->getActionName();
        $backendSession = $this->container->get('backendsession');

        if (
            Shopware()->Plugins()->Backend()->Auth()->shouldAuth()
            && $this->isPasswordConfirmProtectedAction($calledAction)
            && $backendSession->offsetGet('passwordVerified')
        ) {
            $backendSession->offsetUnset('passwordVerified');
        }
    }
Home | Imprint | This part of the site doesn't use cookies.