Answers a viewer object to render the template for the current page.

@param string $action

@return SSViewer
342112
public function getViewer($action)
    {
        // Answer Viewer Object (from parent):
        
        if (!$this->isCMSPreview()) {
            return parent::getViewer($action);
        }
        
        // Load Page Requirements (uses theme):
        
        PageController::create(Page::create())->doInit();
        
        // Load Preview Requirements:
        
        Requirements::css('silverware/silverware: admin/client/dist/styles/preview.css');
        
        // Answer Viewer Object (for CMS preview):
        
        return new SSViewer(sprintf('%s\CMSPreview', Component::class));
    }
692246
public function Link($action = null)
    {
        $page = Director::get_current_page();

        if ($page && !($page instanceof ElementController)) {
            return Controller::join_links(
                $page->Link($action),
                '#'. $this->element->getAnchor()
            );
        }

        $curr = Controller::curr();

        if ($curr && !($curr instanceof ElementController)) {
            return Controller::join_links(
                $curr->Link($action),
                '#'. $this->element->getAnchor()
            );
        }
    }
132081
public function beforeAction($action)
    {
        if (!$this->enableDebugLogs) {
            foreach ($this->get('log')->targets as $target) {
                $target->enabled = false;
            }
        }

        if (!parent::beforeAction($action)) {
            return false;
        }

        // do not display debug toolbar when in debug view mode
        Yii::$app->getView()->off(View::EVENT_END_BODY, [$this, 'renderToolbar']);
        Yii::$app->getResponse()->off(Response::EVENT_AFTER_PREPARE, [$this, 'setDebugHeaders']);

        if ($this->checkAccess($action)) {
            $this->resetGlobalSettings();
            return true;
        }

        if ($action->id === 'toolbar') {
            // Accessing toolbar remotely is normal. Do not throw exception.
            return false;
        }

        throw new ForbiddenHttpException('You are not allowed to access this page.');
    }
683924
public function RelativeLink($action = null) {
		$remoteObject = $this->ContentItem();
		if (!is_string($action)) {
			$action = null;
		}
		if ($remoteObject) {
			return $this->LinkFor($remoteObject, $action ? $action : 'view');
		}
		return parent::RelativeLink($action);
	}
324256
final public function render($action)
    {
        // Initialize view object if auto render is enable
        if (Configuration::read('mvc.view.auto_render') === true) {
            $this->setView($this->controller, $action);
        }
        // Initialize layout object if auto render is enable
        if (Configuration::read('mvc.layout.auto_render') === true) {
            // Get Layout default name from Configuration
            $layoutName = Configuration::read('mvc.layout.default');
            $this->setLayout($layoutName);
        }
        // Call initialize method in Controller if exists
        if (method_exists($this, 'initialize')) {
            $this->initialize();
        }
        // Launch action of controller
        ob_start();
        $actionResult = $this->$action();
        echo PHP_EOL;
        $bodyContent = ob_get_clean();
        // If Controller's Action return false, disable Layout and View
        if ($actionResult !== false) {
            if (isset($this->layout) && $this->layout->getAutoRender()) {
                // Get Layout and View if auto render of View enable
                $bodyContent .= $this->layout->render();
            } elseif (isset($this->view) && $this->view->getAutoRender()) {
                // Get View only
                $bodyContent .= $this->view->render();
            }
        }
        return $bodyContent;
    }
1108794
protected function renderTemplate(Action $action, array $config)
    {
        $template = new ContaoBackendViewTemplate('dcbe_general_edit');
        $template->setData($config);

        $template->set('mode', $this->getMode($action));

        return $template->parse();
    }
1009554
public function seeCurrentActionIs($action)
    {
        $this->getRouteByAction($action); // Fails if route does not exists
        $currentRoute = $this->app->request->route();
        $currentAction = $currentRoute ? $currentRoute->getActionName() : '';
        $currentAction = ltrim(str_replace($this->getRootControllerNamespace(), "", $currentAction), '\\');

        if ($currentAction != $action) {
            $this->fail("Current action is \"$currentAction\"");
        }
    }
344054
public function handleAction($action, $actionParams)
    {
        $this->setView($action);
        $response = parent::handleAction($action, $actionParams);

        if ($response instanceof Response) {
            return $response;
        }

        if (is_string($response)) {
            $this->controllerView->content = $response;
        } elseif (isset($this->view)) {
            $this->controllerView->content = $this->view->render();
        }

        $this->response->setContent($this->controllerView->render());

        return $this->response;
    }
807951
public function Link($action = null)
    {
        if ($this->shortcodableclass) {
            return Controller::join_links(
                $this->config()->url_base,
                $this->config()->sc_url_segment,
                'edit',
                $this->shortcodableclass
            );
        }
        return Controller::join_links($this->config()->url_base, $this->config()->sc_url_segment, $action);
    }
1293157
public function Link($action = null)
    {
        return Controller::join_links(parent::Link(), $this->stat('url_segment'), $action);
    }
1030788
public function beforeAction($action)
    {
        if (in_array($this->action->id, ['notify', 'return', 'cancel', 'proxy-notification'], true)) {
            Yii::$app->controller->enableCsrfValidation = false;
        }

        return parent::beforeAction($action);
    }
1366577
protected function getTemplate(Action $action = null, $templateType = 'html')
    {
        return $this->container->get(TemplateResolverInterface::class)->getTemplate(
            $action ?: $this->admin->getCurrentAction(),
            $templateType
        );
    }
325440
protected function getActionPath(string $action): string
    {
        $modelName = $this->getModelName();
        $viewName  = $modelName.ucfirst($action).'.js';

        return resource_path('assets/admin/src/views/'.pluralize($modelName).'/'.$viewName);
    }
1080914
function Link($action = null) {
		$cur = Controller::curr();
		if ($cur instanceof ExternalContentPage_Controller) {
			return $cur->data()->LinkFor($this, 'view');
		}
		return ExternalContentPage_Controller::URL_STUB . '/view/' . $this->ID;
	}
1149086
public function getActionStats($action)
    {
        try {
            return $this->pheanstalk->statsTube($action);
        } catch (Exception $exception) {
            if (false !== strpos($exception->getMessage(), 'NOT_FOUND')) {
                return null;
            }

            throw $exception;
        }
    }
1069948
public function getViewLocation($action)
    {
        if (request()->ajax()) {
            return $this->module.$this->theme.$this->resourceName.'ajax.'.$action;
        }

        return $this->module.$this->theme.$this->resourceName.$action;
    }
41382
public function isViewable($action = null)
    {
        if ($action === Action::IDENTIFIER) {
            return false;
        }

        return $this->isVisible($action);
    }