/**
  * 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\FLOW3\MVC\View\ViewInterface $view The view to be initialized
  * @return void
  * @api
  */
 protected function initializeView(\TYPO3\FLOW3\MVC\View\ViewInterface $view)
 {
     $menuItems = array();
     $this->addMenuItem($menuItems, array('label' => 'Clone', 'href' => $this->uriBuilder->reset()->uriFor('index', array(), 'Standard')), 'Standard');
     $this->addMenuItem($menuItems, array('label' => 'Create repository', 'href' => $this->uriBuilder->reset()->uriFor('newRepository', array(), 'Management')), 'Management');
     $view->assignMultiple(array('javascript_debug_timestamp' => '?' . time(), 'menuItems' => $menuItems, 'pre-config' => json_encode((object) array('host' => $this->settings['host'], 'email' => $this->getDefaultEmail()))));
 }
 /**
  * Apply settings to use a different template for the planet
  *
  * @param \TYPO3\FLOW3\Mvc\View\ViewInterface $view
  * @return void
  */
 protected function initializeView(\TYPO3\FLOW3\Mvc\View\ViewInterface $view)
 {
     if ($view instanceof \TYPO3\Fluid\View\TemplateView) {
         if (isset($this->settings['frontend']['view']['templateRootPath'])) {
             $view->setTemplateRootPath($this->settings['frontend']['view']['templateRootPath']);
         }
         if (isset($this->settings['frontend']['view']['layoutRootPath'])) {
             $view->setLayoutRootPath($this->settings['frontend']['view']['layoutRootPath']);
         }
         if (isset($this->settings['frontend']['view']['partialRootPath'])) {
             $view->setPartialRootPath($this->settings['frontend']['view']['partialRootPath']);
         }
     }
 }
Exemple #3
0
 /**
  * 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 {
         $ignoreValidationAnnotations = $this->reflectionService->getMethodAnnotations(get_class($this), $this->actionMethodName, 'TYPO3\\FLOW3\\Annotations\\IgnoreValidation');
         $ignoredArguments = array_map(function ($annotation) {
             return $annotation->argumentName;
         }, $ignoreValidationAnnotations);
         // if there exists more errors than in ignoreValidationAnnotations_=> call error method
         // else => call action method
         $shouldCallActionMethod = TRUE;
         foreach ($validationResult->getSubResults() as $argumentName => $subValidationResult) {
             if (!$subValidationResult->hasErrors()) {
                 continue;
             }
             if (array_search($argumentName, $ignoredArguments) !== FALSE) {
                 continue;
             }
             $shouldCallActionMethod = FALSE;
         }
         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\FLOW3\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);
     }
 }
 /**
  * @param \TYPO3\FLOW3\Mvc\View\ViewInterface $view
  * @return void
  */
 protected function initializeView(\TYPO3\FLOW3\Mvc\View\ViewInterface $view)
 {
     $view->assignMultiple(array('moduleConfiguration' => $this->moduleConfiguration, 'moduleBreadcrumb' => $this->moduleBreadcrumb));
 }