/**
  * @test
  */
 public function ifNoTypoScriptViewIsFoundThenFallbackViewIsExecuted()
 {
     $view = $this->buildView('Foo\\Bar\\Controller\\TestController', 'nonExisting');
     $this->mockFallbackView->expects($this->once())->method('render')->will($this->returnValue('FallbackView called'));
     $this->mockFallbackView->expects($this->once())->method('setControllerContext')->with($this->mockControllerContext);
     $this->assertEquals('FallbackView called', $view->render());
 }
 /**
  * Initialize view with default typoscript path for the plugin view
  *
  * @param \TYPO3\Flow\Mvc\View\ViewInterface $view The view to be initialized
  * @return void
  * @api
  */
 protected function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     $request = $this->request;
     $packageKey = str_replace('.', '', $request->getControllerPackageKey());
     $controllerName = $request->getControllerName();
     $actionName = $request->getControllerActionName();
     $view->setTypoScriptPath(sprintf('plugins/%s/%s/%s', $packageKey, $controllerName, $actionName));
     $node = $request->getInternalArgument('__node');
     $view->assign('value', $node);
 }
 /**
  * Initialize view action
  *
  * @param \TYPO3\Flow\Mvc\View\ViewInterface $view
  * @return void
  */
 protected function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     $loggedUser = $this->securityContext->getAccount();
     $currentUrl = $this->request->getHttpRequest()->getUri();
     $view->assign('currentpage', $currentUrl);
     $view->assign('state', $this->base64UrlEncode($currentUrl));
     if ($loggedUser != NULL) {
         $view->assign('loggedInUser', $this->securityContext->getAccount()->getAccountIdentifier());
         $view->assign('currentUser', $this->securityContext->getAccount()->getParty());
     }
     $facebook_appid = $this->facebookService->getAppId();
     $facebook_redirecturi = $this->facebookService->getRedirectUri();
     $vkLoginUrl = $this->vkService->getAuthorizationUri();
     $this->view->assignMultiple(array('vk_url' => $vkLoginUrl, 'google_url' => $this->googlePlusService->getAuthorizationUri(), 'facebook_appid' => $facebook_appid, 'facebook_redirecturi' => $facebook_redirecturi));
 }
 /**
  * @param \TYPO3\Flow\Mvc\View\ViewInterface $view
  * @return void
  */
 public function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     if ($this->request->getFormat() === 'html') {
         $javascriptFilesToInclude = $this->settings['javaScripts'];
         foreach ($this->settings['panels'] as $panelConfigurations) {
             foreach ($panelConfigurations as $panelName => $panelConfiguration) {
                 if (isset($panelConfiguration['javascripts'])) {
                     $javascriptFilesToInclude[$panelName] = $panelConfiguration['javascripts'];
                 }
             }
         }
         $view->assign('stylesheets', $this->filterAndSortArray($this->settings['stylesheets']));
         $view->assign('javaScripts', $this->filterAndSortArray($javascriptFilesToInclude));
         $view->assign('panels', $this->settings['panels']);
     }
 }
 /**
  * Initializes the view before invoking an action method.
  *
  * Override this method to solve assign variables common for all actions
  * or prepare the view in another way before the action is called.
  *
  * @param \TYPO3\Flow\Mvc\View\ViewInterface $view The view to be initialized
  * @return void
  * @api
  */
 protected function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     $currentNode = $this->request->getInternalArgument('__node');
     if ($currentNode !== NULL) {
         $pluginArguments = $currentNode->getProperties();
     }
     // set the template paths from the Settings
     // so that it can be changed per project
     // do this only if it is a TemplateView to avoid FATAL errors
     if ($view instanceof \TYPO3\Fluid\View\TemplateView) {
         if (!empty($pluginArguments['templatePath'])) {
             $view->setTemplatePathAndFilename($pluginArguments['templatePath']);
         } else {
             $view->setTemplateRootPath($this->settings['templateRootPath']);
         }
         if (!empty($pluginArguments['partialRootPath'])) {
             $view->setPartialRootPath($pluginArguments['partialRootPath']);
         } else {
             $view->setPartialRootPath($this->settings['partialRootPath']);
         }
         if (!empty($pluginArguments['layoutRootPath'])) {
             $view->setLayoutRootPath($pluginArguments['layoutRootPath']);
         } else {
             $view->setLayoutRootPath($this->settings['layoutRootPath']);
         }
     }
 }
 /**
  * Calls the specified action method and passes the arguments.
  *
  * If the action returns a string, it is appended to the content in the
  * response object. If the action doesn't return anything and a valid
  * view exists, the view is rendered automatically.
  *
  * @return void
  */
 protected function callActionMethod()
 {
     $preparedArguments = [];
     foreach ($this->arguments as $argument) {
         $preparedArguments[] = $argument->getValue();
     }
     $validationResult = $this->arguments->getValidationResults();
     if (!$validationResult->hasErrors()) {
         $actionResult = call_user_func_array([$this, $this->actionMethodName], $preparedArguments);
     } else {
         $actionIgnoredArguments = static::getActionIgnoredValidationArguments($this->objectManager);
         if (isset($actionIgnoredArguments[$this->actionMethodName])) {
             $ignoredArguments = $actionIgnoredArguments[$this->actionMethodName];
         } else {
             $ignoredArguments = [];
         }
         // if there exists more errors than in ignoreValidationAnnotations => call error method
         // else => call action method
         $shouldCallActionMethod = true;
         /** @var Result $subValidationResult */
         foreach ($validationResult->getSubResults() as $argumentName => $subValidationResult) {
             if (!$subValidationResult->hasErrors()) {
                 continue;
             }
             if (isset($ignoredArguments[$argumentName]) && $subValidationResult->getErrors(TargetNotFoundError::class) === []) {
                 continue;
             }
             $shouldCallActionMethod = false;
             break;
         }
         if ($shouldCallActionMethod) {
             $actionResult = call_user_func_array([$this, $this->actionMethodName], $preparedArguments);
         } else {
             $actionResult = call_user_func([$this, $this->errorMethodName]);
         }
     }
     if ($actionResult === null && $this->view instanceof ViewInterface) {
         $this->response->appendContent($this->view->render());
     } elseif (is_string($actionResult) && strlen($actionResult) > 0) {
         $this->response->appendContent($actionResult);
     } elseif (is_object($actionResult) && method_exists($actionResult, '__toString')) {
         $this->response->appendContent((string) $actionResult);
     }
 }
 /**
  * Calls the specified action method and passes the arguments.
  *
  * If the action returns a string, it is appended to the content in the
  * response object. If the action doesn't return anything and a valid
  * view exists, the view is rendered automatically.
  *
  * @return void
  */
 protected function callActionMethod()
 {
     $preparedArguments = array();
     foreach ($this->arguments as $argument) {
         $preparedArguments[] = $argument->getValue();
     }
     $validationResult = $this->arguments->getValidationResults();
     if (!$validationResult->hasErrors()) {
         $actionResult = call_user_func_array(array($this, $this->actionMethodName), $preparedArguments);
     } else {
         $actionIgnoredArguments = static::getActionIgnoredValidationArguments($this->objectManager);
         if (isset($actionIgnoredArguments[$this->actionMethodName])) {
             $ignoredArguments = $actionIgnoredArguments[$this->actionMethodName];
         } else {
             $ignoredArguments = array();
         }
         // if there exists more errors than in ignoreValidationAnnotations => call error method
         // else => call action method
         $shouldCallActionMethod = TRUE;
         /** @var Result $subValidationResult */
         foreach ($validationResult->getSubResults() as $argumentName => $subValidationResult) {
             if (!$subValidationResult->hasErrors()) {
                 continue;
             }
             if (isset($ignoredArguments[$argumentName]) && $subValidationResult->getErrors('TYPO3\\Flow\\Property\\TypeConverter\\Error\\TargetNotFoundError') === array()) {
                 continue;
             }
             $shouldCallActionMethod = FALSE;
             break;
         }
         if ($shouldCallActionMethod) {
             $actionResult = call_user_func_array(array($this, $this->actionMethodName), $preparedArguments);
         } else {
             $actionResult = call_user_func(array($this, $this->errorMethodName));
         }
     }
     if ($actionResult === NULL && $this->view instanceof \TYPO3\Flow\Mvc\View\ViewInterface) {
         $this->response->appendContent($this->view->render());
     } elseif (is_string($actionResult) && strlen($actionResult) > 0) {
         $this->response->appendContent($actionResult);
     } elseif (is_object($actionResult) && method_exists($actionResult, '__toString')) {
         $this->response->appendContent((string) $actionResult);
     }
 }
 /**
  * Set common variables on the view
  *
  * @param ViewInterface $view
  * @return void
  */
 protected function initializeView(ViewInterface $view)
 {
     $view->assignMultiple(array('view' => $this->browserState->get('view'), 'sortBy' => $this->browserState->get('sortBy'), 'sortDirection' => $this->browserState->get('sortDirection'), 'filter' => $this->browserState->get('filter'), 'activeTag' => $this->browserState->get('activeTag'), 'activeAssetCollection' => $this->browserState->get('activeAssetCollection')));
 }
 public function initializeView(ViewInterface $view)
 {
     $view->setTypoScriptPath('backend');
 }
Example #10
0
 /**
  * @param ViewInterface $view
  * @return void
  */
 protected function initializeView(ViewInterface $view)
 {
     /** @var TemplateView $view */
     $view->setOption('templateRootPathPattern', '@packageResourcesPath/Private/');
     parent::initializeView($view);
 }
Example #11
0
 /**
  * Initializes the view and assigns stuff like the locale and the language-navigation
  * options to the view, so they are available in every action's view.
  *
  * @param \TYPO3\Flow\Mvc\View\ViewInterface $view
  * @return void
  */
 protected function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     $view->assign('account', $this->account);
 }
 /**
  * @param ViewInterface $view
  * @return void
  */
 public function initializeView(ViewInterface $view)
 {
     $view->assign('asyncThumbnails', $this->asyncThumbnails);
 }
 /**
  * Initialize and render the fallback view
  *
  * @return string
  */
 public function renderFallbackView()
 {
     $this->fallbackView->setControllerContext($this->controllerContext);
     $this->fallbackView->assignMultiple($this->variables);
     return $this->fallbackView->render();
 }
 /**
  * Initializes the view before invoking an action method.
  *
  * Will call the "initializeReport" method if the view implements the ReportInterface
  *
  * @param \TYPO3\Flow\Mvc\View\ViewInterface $view The view to be initialized
  * @return void
  */
 protected function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     if ($view instanceof \ThinkopenAt\TimeFlies\View\ReportInterface) {
         $format = $this->request->getFormat();
         $reportKey = $this->reportViews[$format]['reportKey'];
         $view->initializeReport($reportKey);
     }
 }
 /**
  * @param \TYPO3\Flow\Mvc\View\ViewInterface $view
  * @return void
  */
 public function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     $view->assign('asyncThumbnails', $this->asyncThumbnails);
 }
 protected function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     $view->assign('model', $this->getModelType());
 }
 /**
  * @param ViewInterface $view
  * @return void
  */
 protected function initializeView(ViewInterface $view)
 {
     $view->assign('moduleConfiguration', $this->moduleConfiguration);
 }
 /**
  * Set the resource configuration on the view
  *
  * @param \TYPO3\Flow\Mvc\View\ViewInterface $view
  * @return void
  */
 protected function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     $view->setConfiguration($this->viewConfiguration);
 }