Reports a layout action with dependencies to the log
@param Layout $layout The layout being manipulated
@param Enums\Action $action The operation executed on the layout
773776
function ReportLayoutAction(Layout $layout, Enums\Action $action)
    {
        $logItem = $this->CreateLogItem(Enums\ObjectType::Layout(), $action);       
        if (!$action->Equals(Enums\Action::Delete()))
        {
            $logLayout = new LogLayout();
            $logLayout->SetLogItem($logItem);
            $logLayout->SetLayout($layout);
            $logLayout->Save();
        }
        else
        {
            //pages are deleted in cascade
            $pages = Page::Schema()->FetchByLayout(false, $layout);
            foreach ($pages as $page)
            {
                $this->ReportPageAction($page, Enums\Action::Delete());
            }
        }
    }
949559
protected function getLayoutFile(Layout $layout)
    {
        $layoutfile = $layout->getPath();
        if (null === $layoutfile && 0 < count($this->_includeExtensions)) {
            $ext = reset($this->_includeExtensions);
            $layoutfile = StringUtils::toPath($layout->getLabel(), array('extension' => $ext));
            $layout->setPath($layoutfile);
        }

        return $layoutfile;
    }
1313995
public void setLayout(java.lang.String layout) {
        getStateHelper().put(PropertyKeys.layout, layout);
    }
452428
public function addItemAction(Request $request, Layout $layout)
    {
        $this->guard($layout, 'update');

        $region = $this->validateInputAndGetRegionName($request);

        $nid = $request->get('nid');
        if (empty($nid)) {
            throw $this->createNotFoundException();
        }
        if (!$node = $this->getNodeStorage()->load($nid)) {
            throw $this->createNotFoundException();
        }
        if (!$node->access('view')) {
            throw $this->createAccessDeniedException();
        }

        $viewmode = $request->get('view_mode', 'teaser');
        $position = $request->get('position');
        $manager  = $this->getContextManager();
        $site     = $this->getSiteContext();
        $item     = new Item($nid, $viewmode);
        $region   = $layout->getRegion($region);

        $region->addAt($item, $position);

        if ($manager->isPageContextRegion($region->getName(), $site->theme)) {
            $manager->getPageContext()->getStorage()->save($layout);
        } else if ($manager->isTransversalContextRegion($region->getName(), $site->theme)) {
            $manager->getSiteContext()->getStorage()->save($layout);
        } else {
            throw $this->createAccessDeniedException();
        }

        return new JsonResponse(['success' => true, 'output' => $this->renderNode($node, $region, $viewmode)]);
    }
1243936
protected function deployActionDependOnDelivery(ActionInterface $action)
    {
        if ($this->deployer && $this->deployer->isDeliveryImmediate()) {
            $this->deployer->deploy($action, $this);
        }
    }
1120914
public function view($layout, $name=null)
	{
		// If we were passed only a view model, just render it.
		if ($layout instanceof AbstractView)
		{
			return $layout;
		}

		$view = new self(array(
			'base_path' => $this->_basePath,
			'name'      => ($name ? $name : $this->_name),
			'layout'    => $layout
		));
		$view->set('option', $this->option)
		     ->set('controller', $this->controller)
		     ->set('task', $this->task);

		return $view;
	}
866251
public function render($view = null, $layout = null)
    {
        $content = parent::render($view, $layout);
        if ($this->response->type() == 'text/html') {
            return $content;
        }

        $this->Blocks->set('content', $this->output());
        $this->response->download($this->getFilename());

        return $this->Blocks->get('content');
    }
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;
    }
926909
public function execute($action) {
        admin_externalpage_setup('tool_usertours/tours');
        // Add the main content.
        switch($action) {
            case self::ACTION_NEWTOUR:
            case self::ACTION_EDITTOUR:
                $this->edit_tour(optional_param('id', null, PARAM_INT));
                break;

            case self::ACTION_MOVETOUR:
                $this->move_tour(required_param('id', PARAM_INT));
                break;

            case self::ACTION_EXPORTTOUR:
                $this->export_tour(required_param('id', PARAM_INT));
                break;

            case self::ACTION_IMPORTTOUR:
                $this->import_tour();
                break;

            case self::ACTION_VIEWTOUR:
                $this->view_tour(required_param('id', PARAM_INT));
                break;

            case self::ACTION_HIDETOUR:
                $this->hide_tour(required_param('id', PARAM_INT));
                break;

            case self::ACTION_SHOWTOUR:
                $this->show_tour(required_param('id', PARAM_INT));
                break;

            case self::ACTION_DELETETOUR:
                $this->delete_tour(required_param('id', PARAM_INT));
                break;

            case self::ACTION_RESETFORALL:
                $this->reset_tour_for_all(required_param('id', PARAM_INT));
                break;

            case self::ACTION_NEWSTEP:
            case self::ACTION_EDITSTEP:
                $this->edit_step(optional_param('id', null, PARAM_INT));
                break;

            case self::ACTION_MOVESTEP:
                $this->move_step(required_param('id', PARAM_INT));
                break;

            case self::ACTION_DELETESTEP:
                $this->delete_step(required_param('id', PARAM_INT));
                break;

            case self::ACTION_LISTTOURS:
            default:
                $this->print_tour_list();
                break;
        }
    }
646723
protected function CanDelete(Layout $layout)
    {
        return self::Guard()->Allow(BackendAction::Delete(), $layout)
            && self::Guard()->Allow(BackendAction::UseIt(), new LayoutForm());
    }
29103
protected function setupLayout($layout = null)
    {
        $this->layout = !is_null($layout) ? $layout : $this->layout;
        if ($this->layout && is_string($this->layout) && view()->exists($this->layout)) {
            $this->layout = view($this->layout);
        }
    }
1235252
public static function formTb(
        $layout = self::FORM_LAYOUT_VERTICAL,
        $action = '',
        $method = 'post',
        $htmlOptions = array()
    ) {
        return self::beginFormTb($layout, $action, $method, $htmlOptions);
    }
1316409
public function removeLayout(Layout $layout)
    {
        if (null === $layout->getSite()) {
            return false;
        }

        $layoutfile = $this->getLayoutFile($layout);
        @unlink($layoutfile);
    }
1163838
public static function addAction(string $code, array $action) {
		$action['order'] = $action['order'] ?? 0;
		\Application::set(array('layout', 'actions', $code), $action);
	}
457216
public function runAction($action)
    {
        $doing = ucfirst(trim($action, 'e')) . 'ing';
        $this->plugin->io->writeError('<info>' . $doing . ' ' . $this->name . ' dependencies...</info>');
        $this->saveConfigs();
        $this->perform($action);
    }
1293048
function ReportAreaAction(Area $area, Enums\Action $action)
    {
        $logItem = $this->CreateLogItem(Enums\ObjectType::Area(), $action);       
        if (!$action->Equals(Enums\Action::Delete()))
        {
            $logArea = new LogArea();
            $logArea->SetLogItem($logItem);
            $logArea->SetArea($area);
            $logArea->Save();
        }
        else
        {
            $this->ReportLayoutAction($area->GetLayout(), Enums\Action::ChildDelete());
        }
    }
1281285
function ReportUserGroupAction(Usergroup $userGroup, Enums\Action $action)
    {
        $logItem = $this->CreateLogItem(Enums\ObjectType::UserGroup(), $action);       
        if (!$action->Equals(Enums\Action::Delete()))
        {
            $logUserGroup = new LogUsergroup();
            $logUserGroup->SetLogItem($logItem);
            $logUserGroup->SetUserGroup($userGroup);
            $logUserGroup->Save();
        }
    }