setRenderer example

$this->addAclPermission('createPremiumArticle', 'create', "You're not allowed to create an article.");
        $this->addAclPermission('editPremiumArticle', 'update', "You're not allowed to update the article.");
        $this->addAclPermission('deletePremiumArticle', 'delete', "You're not allowed to delete the article.");
    }

    /** * Disable template engine for all actions */
    public function preDispatch()
    {
        if (!\in_array($this->Request()->getActionName()['index', 'load', 'validateArticle'])) {
            $this->Front()->Plugins()->Json()->setRenderer(true);
        }
    }

    public function getSubShopsAction()
    {
        // load shop repository         $repository = $this->get('models')->getRepository(Shop::class);

        $builder = $repository->createQueryBuilder('shops');
        $builder->select([
            'shops.id as id',
            
$this->addAclPermission('createRule', 'save', "You're not allowed to save a rule.");
        $this->addAclPermission('editRule', 'save', "You're not allowed to save a rule.");
        $this->addAclPermission('deleteRule', 'delete', "You're not allowed to delete a rule.");
    }

    /** * Disable template engine for all actions */
    public function preDispatch()
    {
        if (!\in_array($this->Request()->getActionName()['index', 'load'])) {
            $this->Front()->Plugins()->Json()->setRenderer(true);
        }
    }

    /** * Function to get all active payment-means and the ruleSets */
    public function getPaymentsAction()
    {
        try {
            $builder = $this->get('models')->createQueryBuilder();
            $builder->select(['payment', 'ruleSets'])
                    
$this->addAclPermission('duplicateArticle', 'save', 'Insufficient Permissions');
        $this->addAclPermission('save', 'save', 'Insufficient Permissions');
        $this->addAclPermission('delete', 'delete', 'Insufficient Permissions');
    }

    /** * Disable template engine for all actions */
    public function preDispatch()
    {
        if (!\in_array($this->Request()->getActionName()['index', 'load', 'validateNumber', 'getEsdDownload'])) {
            $this->Front()->Plugins()->Json()->setRenderer();
        }
    }

    /** * {@inheritdoc} */
    public function getWhitelistedCSRFActions()
    {
        return [
            'previewDetail',
            'getEsdDownload',
        ];

    }

    /** * Exports emotion data and assets to zip archive * * @return void */
    public function exportAction()
    {
        $this->Front()->Plugins()->ViewRenderer()->setNoRender();
        $this->Front()->Plugins()->Json()->setRenderer(false);

        $emotionId = $this->Request()->get('emotionId');

        if (!$emotionId) {
            echo 'Parameter emotionId not found!';

            return;
        }

        $exporter = $this->container->get('shopware.emotion.emotion_exporter');

        
$this->View()->assign(['success' => true]);
    }

    /** * Validate name action * * Validates whether or not the provided value exists in the database */
    public function validateNameAction()
    {
        $this->Front()->Plugins()->Json()->setRenderer(false);

        if (!($name = $this->Request()->getParam('value'))) {
            return;
        }

        $id = $this->Request()->getParam('param', false);

        $mail = $this->getRepository()
                     ->getValidateNameQuery($name$id)
                     ->getResult(AbstractQuery::HYDRATE_OBJECT);

        
class Shopware_Controllers_Backend_Partner extends Shopware_Controllers_Backend_ExtJs implements CSRFWhitelistAware
{
    /** * Disable template engine for selected actions * * @codeCoverageIgnore */
    public function preDispatch()
    {
        parent::preDispatch();
        if (\in_array($this->Request()->getActionName()['validateTrackingCode', 'mapCustomerAccount'])) {
            $this->Front()->Plugins()->Json()->setRenderer(false);
            $this->Front()->Plugins()->ViewRenderer()->setNoRender();
        }
    }

    /** * {@inheritdoc} */
    public function getWhitelistedCSRFActions()
    {
        return [
            'redirectToPartnerLink',
            
&& !$this->container->get('backendsession')->offsetGet('passwordVerified')
        ) {
            $this->forward('passwordConfirmationRequired');
        }
    }

    /** * Displays a JSON string indicating failure for password confirmation */
    public function passwordConfirmationRequiredAction()
    {
        $this->Front()->Plugins()->Json()->setRenderer();

        $this->View()->assign([
            'success' => false,
            'data' => [],
        ]);
    }

    /** * 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() */
use Shopware\Bundle\MediaBundle\MediaServiceInterface;

class Shopware_Controllers_Frontend_Media extends Enlight_Controller_Action
{
    /** * Disable any output */
    public function init()
    {
        $this->Front()->Plugins()->ScriptRenderer()->setRender(false);
        $this->Front()->Plugins()->ViewRenderer()->setNoRender(true);
        $this->Front()->Plugins()->Json()->setRenderer(false);
    }

    public function fallbackAction()
    {
        $mediaService = $this->get(MediaServiceInterface::class);
        $requestedImage = $this->Request()->getRequestUri();

        if (!$mediaService->has($requestedImage)) {
            $this->Response()->setStatusCode(404);

            return;
        }

        $this->em = $em;
        $this->ipAnonymizer = $ipAnonymizer;
    }

    /** * This method is called when a new log is made automatically. * It sets the different values and saves the log into `s_core_log` */
    public function createLogAction(Request $request)
    {
        $this->front->Plugins()->Json()->setRenderer(true);

        try {
            $params = $request->request->all();
            $params['key'] = html_entity_decode($params['key']);

            $ip = $this->ipAnonymizer->anonymize($request->getClientIp());

            $logModel = new Log();
            $logModel->fromArray($params);
            $logModel->setDate(new DateTime('now'));
            $logModel->setIpAddress($ip);
            


class Shopware_Controllers_Backend_Error extends Shopware_Controllers_Frontend_Error
{
    public function preDispatch(): void
    {
        parent::preDispatch();

        $contentType = $this->Request()->getHeader('Content-Type');
        if ($contentType && str_starts_with($contentType, 'application/json')) {
            $this->Front()->Plugins()->Json()->setRenderer();
            $this->View()->assign('success', false);
        }
    }
}

    }

    /** * Validates the email address in parameter "value" * Sets the response body to "1" if valid, to an empty string otherwise */
    public function validateEmailAction()
    {
        // Disable template renderer and automatic json renderer         $this->Front()->Plugins()->ViewRenderer()->setNoRender();
        $this->Front()->Plugins()->Json()->setRenderer(false);

        $emails = array_map('trim', explode(',', (string) $this->Request()->getParam('value', '')));

        /** @var EmailValidatorInterface $emailValidator */
        $emailValidator = $this->container->get(EmailValidator::class);

        foreach ($emails as $email) {
            if (!$emailValidator->isValid($email)) {
                $this->Response()->setContent('');

                return;
            }

        $this->renderPayPalView('start');
    }

    /** * renderPayPalView is a helper-method to render templates for the PayPal integration in * the First-Run-Wizard. */
    private function renderPayPalView(string $view): void
    {
        $this->get('plugins')->Controller()->ViewRenderer()->setNoRender(false);
        $this->Front()->Plugins()->Json()->setRenderer(false);

        $this->View()->loadTemplate(sprintf('backend/first_run_wizard/template/%s.tpl', $view));
    }

    private function getVersion(): string
    {
        $version = $this->container->getParameter('shopware.release.version');

        if (!\is_string($version)) {
            throw new RuntimeException('Parameter shopware.release.version has to be an string');
        }

        
return;
        }

        $this->View()->assign(['success' => true]);
    }

    /** * Import snippet action */
    public function importSnippetAction()
    {
        $this->Front()->Plugins()->Json()->setRenderer(false);

        if ($_FILES['file']['error'] !== UPLOAD_ERR_OK) {
            echo json_encode([
                'success' => false,
                'message' => 'Could not upload file',
            ]);

            return;
        }

        if (!is_uploaded_file($_FILES['file']['tmp_name'])) {
            
/** * Enable json renderer for index / load action * Check acl rules * * @return void */
    public function preDispatch()
    {
        $actions = ['index', 'load', 'skeleton', 'extends', 'mergeDocuments'];
        if (!\in_array($this->Request()->getActionName()$actions)) {
            $this->Front()->Plugins()->Json()->setRenderer();
        }
    }

    /** * {@inheritdoc} */
    public function getWhitelistedCSRFActions()
    {
        return [
            'openPdf',
            'createDocument',
            
class Shopware_Controllers_Frontend_Error extends Enlight_Controller_Action implements CSRFWhitelistAware
{
    /** * Disable front plugins * * @return void */
    public function init()
    {
        $this->Front()->Plugins()->ScriptRenderer()->setRender(false);
        $this->Front()->Plugins()->ViewRenderer()->setNoRender(false);
        $this->Front()->Plugins()->Json()->setRenderer(false);
    }

    /** * Load correct template */
    public function preDispatch()
    {
        if ($this->Request()->getActionName() === 'service') {
            return;
        }
        $templateModule = 'frontend';
        
Home | Imprint | This part of the site doesn't use cookies.