Example #1
0
 /**
  * Determines the fully qualified view object name.
  *
  * @return mixed The fully qualified view object name or FALSE if no matching view could be found.
  * @api
  */
 protected function resolveViewObjectName()
 {
     $vendorName = $this->request->getControllerVendorName();
     if ($vendorName !== NULL) {
         $possibleViewName = str_replace('@vendor', $vendorName, $this->namespacesViewObjectNamePattern);
     } else {
         $possibleViewName = $this->viewObjectNamePattern;
     }
     $possibleViewName = str_replace(array('@extension', '@controller', '@action'), array($this->request->getControllerExtensionName(), $this->request->getControllerName(), ucfirst($this->request->getControllerActionName())), $possibleViewName);
     $format = $this->request->getFormat();
     $viewObjectName = str_replace('@format', ucfirst($format), $possibleViewName);
     if (class_exists($viewObjectName) === FALSE) {
         $viewObjectName = str_replace('@format', '', $possibleViewName);
     }
     if (isset($this->viewFormatToObjectNameMap[$format]) && class_exists($viewObjectName) === FALSE) {
         $viewObjectName = $this->viewFormatToObjectNameMap[$format];
     }
     return class_exists($viewObjectName) ? $viewObjectName : FALSE;
 }
Example #2
0
 /**
  * Determines the fully qualified view object name.
  *
  * @return mixed The fully qualified view object name or FALSE if no matching view could be found.
  * @api
  */
 protected function resolveViewObjectName()
 {
     $vendorName = $this->request->getControllerVendorName();
     if ($vendorName === null) {
         return false;
     }
     $possibleViewName = str_replace(['@vendor', '@extension', '@controller', '@action'], [$vendorName, $this->request->getControllerExtensionName(), $this->request->getControllerName(), ucfirst($this->request->getControllerActionName())], $this->namespacesViewObjectNamePattern);
     $format = $this->request->getFormat();
     $viewObjectName = str_replace('@format', ucfirst($format), $possibleViewName);
     if (class_exists($viewObjectName) === false) {
         $viewObjectName = str_replace('@format', '', $possibleViewName);
     }
     if (isset($this->viewFormatToObjectNameMap[$format]) && class_exists($viewObjectName) === false) {
         $viewObjectName = $this->viewFormatToObjectNameMap[$format];
     }
     return class_exists($viewObjectName) ? $viewObjectName : false;
 }