Build the proper pluginRequest to render the PluginView
of some configured Master Plugin

@return ActionRequest
540576
protected function buildPluginRequest()
    {
        /** @var $parentRequest ActionRequest */
        $parentRequest = $this->runtime->getControllerContext()->getRequest();
        $pluginRequest = new ActionRequest($parentRequest);

        if (!$this->pluginViewNode instanceof NodeInterface) {
            $pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace());
            $this->passArgumentsToPluginRequest($pluginRequest);
            $pluginRequest->setControllerPackageKey($this->getPackage());
            $pluginRequest->setControllerSubpackageKey($this->getSubpackage());
            $pluginRequest->setControllerName($this->getController());
            $pluginRequest->setControllerActionName($this->getAction());
            return $pluginRequest;
        }

        $pluginNodeIdentifier = $this->pluginViewNode->getProperty('plugin');
        if (strlen($pluginNodeIdentifier) === 0) {
            return $pluginRequest;
        }

        // Set the node to render this to the master plugin node
        $this->node = $this->pluginViewNode->getContext()->getNodeByIdentifier($pluginNodeIdentifier);
        if ($this->node === null) {
            return $pluginRequest;
        }

        $pluginRequest->setArgument('__node', $this->node);
        $pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace());
        $this->passArgumentsToPluginRequest($pluginRequest);

        if ($pluginRequest->getControllerObjectName() !== '') {
            return $pluginRequest;
        }

        $controllerObjectPairs = [];
        $pluginViewName = $this->pluginViewNode->getProperty('view');
        foreach ($this->pluginService->getPluginViewDefinitionsByPluginNodeType($this->node->getNodeType()) as $pluginViewDefinition) {
            /** @var PluginViewDefinition $pluginViewDefinition */
            if ($pluginViewDefinition->getName() !== $pluginViewName) {
                continue;
            }
            $controllerObjectPairs = $pluginViewDefinition->getControllerActionPairs();
            break;
        }

        if ($controllerObjectPairs === []) {
            return $pluginRequest;
        }

        $defaultControllerObjectName = key($controllerObjectPairs);
        $defaultActionName = current($controllerObjectPairs[$defaultControllerObjectName]);
        $pluginRequest->setControllerObjectName($defaultControllerObjectName);
        $pluginRequest->setControllerActionName($defaultActionName);

        return $pluginRequest;
    }
342654
public function indexAction()
    {
        $visibilityService = $this->getVisibilityService();
        $options = $visibilityService->getOptions();

        $widgetId = $options->getWidgetId();
        if (! $widgetId) {
            $this->flashMessenger()->addMessage(
                $this->scTranslate('The widget identifier was not specified.')
            );
            return $this->redirect()
                ->toRoute('sc-admin/layout')
                ->setStatusCode(303);
        }

        $widget = $this->deriveWidget($widgetId);
        if (empty($widget)) {
            return $this->getResponse();
        }
        if ($this->getRequest()->isPost()) {
            $event = $this->request->getPost('suboperation');
            if (! empty($event)) {
                $events = $this->getEventManager();
                $params = $this->getRequest()->getPost();
                $params['widget_id'] = $widget->getId();
                $result = $events->trigger($event, $this, $params);
                if ($result->last() instanceof Response) {
                    return $result->last();
                }
            }
        }

        $view = new ViewModel;
        $view->options = $options;
        $view->widget = $widget;

        $moduleOptions = $this->getModuleOptions();
        $view->config = $moduleOptions->getWidgetByName($widget->getName());

        $view->list = $visibilityService->getContentList();
        $visibilityService->saveOptions();

        return $view;
    }
367720
protected function buildViewReplacements()
    {
        $viewModule = $this->parseViewModule($this->option('view'));

        if (empty($viewModule)) {
            $viewModule = $this->parseViewModule($this->ask('witch module\'s view do you want to injected to the controller?'));
        }

        $views = $this->getViewModuleFiles($viewModule);

        foreach ($views as $view) {
            if (! file_exists($view.'.blade.php')) {
                if ($this->confirm("The {$viewModule} module has some views does not exist. Do you want to generate it?", true)) {
                    $this->call('make:view', ['name' => $viewModule]);
                }

                break;
            }
        }

        return [
            'DummyRootView' => $viewModule,
        ];
    }
179146
public function index()
    {
        $this->requireAdmin();

        $json = $this->getComposerJson();
        $this->view->installedPackages = $json['require'];

        $pluginInfo = new PluginInformationCollection();
        $pluginInfo->add(FilesPluginInformation::newFromDir(
            PHPCI_DIR . "PHPCI/Plugin/"
        ));
        $pluginInfo->add(ComposerPluginInformation::buildFromYaml(
            PHPCI_DIR . "vendor/composer/installed.json"
        ));

        $this->view->plugins = $pluginInfo->getInstalledPlugins();

        $this->layout->title = Lang::get('plugins');

        return $this->view->render();
    }
999769
public function renderAction()
    {
        $params     = $this->params();
        $navigation = $this->getServiceLocator()
                           ->get( 'Grid\Menu\Model\Menu\Model' )
                           ->findNavigation( $params->fromRoute( 'id' ) );

        $view = new ViewModel( array(
            'navigation' => $navigation,
            'class'      => $params->fromRoute( 'class' ),
        ) );

        return $view->setTerminal( true );
    }
1148598
public function renderFormAction(
        Action $action,
        Request $request,
        FormInterface $form,
        $data = null,
        array $viewParameters = []
    ): Response {
        $viewParameters = array_merge($this->getViewParameters($action, $request, $form, $data), $viewParameters);

        return $this->renderAction($action, $viewParameters);
    }
685906
public function loadPluginAssets()
    {
        $plugin = (string) $this->request->getParam('plugin');
        $prefix = ($this->request->getParam('prefix')) ? $this->request->getParam('prefix') . '/' : null;
        $action = (string) $this->request->getParam('action');

        $controller = (string) $this->request->getParam('controller');
        $widgetName = Str::slug($controller . '-' . $action) . '.js';
        $cssOptions = ['block' => 'css_bottom', 'fullBase' => true, 'force' => Configure::read('debug')];

        $this->Html->css($plugin . '.' . $prefix . 'styles.css', $cssOptions);
        $this->Html->less($plugin . '.' . $prefix . 'styles.less', $cssOptions);
        $this->Html->script([
            $plugin . '.' . $prefix . 'widget/' . $widgetName,
            $plugin . '.' . $prefix . 'script.js'
        ], ['block' => 'script_bottom', 'fullBase' => true]);
    }
1360790
public function actionView()
    {
        $data = [
            'f1' => $this->getContext()->getInput()->get('p1'),
            'f2' => $this->getContext()->getInput()->get('p2'),
            'f3' => $this->getContext()->getInput()->get('id'),
        ];
        $this->outputJson($data);
    }
1293000
public function executeAction()
    {
        $moduleClass = $this->get('request')->get('_module.module');
        $actionName = $this->get('request')->get('_module.action');

        $module = $this->get('module_manager')->get($moduleClass);
        foreach ($module->getControllerPreExecutes() as $controllerPreExecute) {
            if (null !== $retval = call_user_func($controllerPreExecute, $module)) {
                return $retval;
            }
        }

        return $module->getAction($actionName)->executeController();
    }
489879
protected function createAction()
    {
        if (strtolower($this->option('type')) == 'regular' || $this->option('type') == null) {
            return $this->createView();
        }
        if (strtolower($this->option('type')) == 'controller') {
            return $this->createController();
        }
        return $this->createResourceController();
    }
1097164
protected function _findViewByRequest()
    {
        $paths = App::path('Template', $this->plugin);

        $action      = (string) $this->request->getParam('action');
        $controller  = $this->request->getParam('controller');
        $viewFile    = $action . $this->_ext;
        $viewSubPath = $this->_getSubPaths($controller);

        foreach ($paths as $path) {
            foreach ($viewSubPath as $subPath) {
                $full = $path . $subPath . DS . $viewFile;
                if (FS::isFile($full)) {
                    return $action;
                }

                $formView = $path . $subPath . DS . self::VIEW_FORM . $this->_ext;
                if (FS::isFile($formView)) {
                    return self::VIEW_FORM;
                }
            }
        }

        return null;
    }
704738
public function evaluate()
    {
        $currentContext = $this->runtime->getCurrentContext();
        $this->pluginViewNode = $currentContext['node'];
        /** @var $parentResponse Response */
        $parentResponse = $this->runtime->getControllerContext()->getResponse();
        $pluginResponse = new ActionResponse($parentResponse);

        $pluginRequest = $this->buildPluginRequest();
        if ($pluginRequest->getControllerObjectName() === '') {
            $message = 'Master View not selected';
            if ($this->pluginViewNode->getProperty('plugin')) {
                $message = 'Plugin View not selected';
            }
            if ($this->pluginViewNode->getProperty('view')) {
                $message ='Master View or Plugin View not found';
            }
            return $this->pluginViewNode->getContext()->getWorkspaceName() !== 'live' || $this->objectManager->getContext()->isDevelopment() ? '<p>' . $message . '</p>' : '<!-- ' . $message . '-->';
        }
        $this->dispatcher->dispatch($pluginRequest, $pluginResponse);
        return $pluginResponse->getContent();
    }
901163
public function getAction()
	{
		$cntl = $this->createAdmin();

		if( ( $html = $cntl->get() ) == '' ) {
			return $this->setPsrResponse( $cntl->getView()->response() );
		}

		$this->view->assign( 'content', $html );
	}
23090
public function loginpageAction()
    {
        $view = $this->forward()->dispatch('MelisCore\Controller\PluginView',
            [
                'action' => 'generate',
                'appconfigpath' => '/meliscore_login',
                'keyview' => 'meliscore_login',
            ]);

        $background = '';
        $melisMelisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $appConfigForm = $melisMelisCoreConfig->getItem('/meliscore_login');
        if (!empty($appConfigForm['datas']['login_background'])) {
            $background = $appConfigForm['datas']['login_background'];
        }

        $schemeSvc = $this->getServiceLocator()->get('MelisCorePlatformSchemeService');
        $schemeData = $schemeSvc->getCurrentScheme();

        $bundleAsset = $this->getServiceLocator()->get('MelisAssetManagerWebPack')->getAssets();


        $this->layout()->addChild($view, 'content');

        $this->layout()->isLogin = 1;
        $this->layout()->login_background = $background;
        $this->layout()->schemes = $schemeData;
        $this->layout()->bundle = $bundleAsset;

        return $view;

    }
550331
public function RenderControl () {
		$attrsStr = $this->renderControlAttrsWithFieldVars([
			'autoComplete',
		]);
		if (!$this->form->GetFormTagRenderingStatus()) 
			$attrsStr .= (strlen($attrsStr) > 0 ? ' ' : '')
				. 'form="' . $this->form->GetId() . '"';
		$formViewClass = $this->form->GetViewClass();
		return $formViewClass::Format(static::$templates->control, [
			'id'		=> $this->id,
			'name'		=> $this->name,
			'type'		=> $this->type,
			'value'		=> htmlspecialchars($this->value, ENT_QUOTES),
			'attrs'		=> strlen($attrsStr) > 0 ? ' ' . $attrsStr : '',
		]);
	}
1104162
public function renderPluginParams()
    {
        /** @var Extension $entity */
        $tabNav     = [];
        $tabContent = [];
        $entity     = $this->_View->get('entity');
        $params     = Plugin::getData($entity->getName(), 'params');
        foreach ($params->getArrayCopy() as $title => $_params) {
            $fields   = [];
            $_params  = new Data($_params);
            $tabId    = 'tab-' . Str::slug($title);
            $tabNav[] = $this->_View->element('Extensions.Params/tab', [
                'title'  => $title,
                'params' => $_params,
                'tabId'  => $tabId
            ]);

            foreach ($_params as $key => $options) {
                $fieldName = Str::clean('params.' . $key);
                if (is_callable($options)) {
                    $fields[] = call_user_func($options, $this->_View);
                    continue;
                }
                
                if (isset($options['options']) && is_callable($options['options'])) {
                    $options['options'] = call_user_func($options['options'], $this->_View);
                }

                $fields[] = $this->_View->Form->control($fieldName, $options);
            }

            $tabContent[$tabId] = implode(PHP_EOL, $fields);
        }

        return implode(PHP_EOL, [
            $this->_View->element('Extensions.Params/list', ['items' => $tabNav]),
            $this->_View->element('Extensions.Params/content', ['content' => $tabContent])
        ]);
    }
1274600
public function actionView()
    {
        if (!$this->actionView) {
            $this->actionView = new ActionView();
            
            # TODO: add default helpers.
            # make sure namespaced controllers get namespaced helpers added.
            HelperSet::addDefaultHelper('ApplicationHelper');
            
            $this->actionView->setHelperSet(
                new HelperSet(
                    $this->request(),
                    $this->params(),
                    $this->session(),
                    $this->assigns()
                )
            );
            # Set routeSet to baseHelper.
            $this->actionView->helperSet()->setRouteSet($this->routeSet());
            
        }
        return $this->actionView;
    }