Exemple #1
0
 /**
  * Renders subpart view helpers.
  *
  * @param SubpartViewHelper $viewHelper View helper instance to execute.
  * @param string $helperKey The view helper marker key.
  * @param string $content Markup that contains the unsubstituted view helper subpart.
  * @return string Markup with the view helper replaced by the content it returned.
  */
 protected function renderSubpartViewHelper(SubpartViewHelper $viewHelper, $helperKey, $content)
 {
     $viewHelperArgumentLists = $this->getViewHelperArgumentLists($helperKey, $content);
     foreach ($viewHelperArgumentLists as $viewHelperArgumentList) {
         $subpartMarker = '###' . $helperKey . ':' . $viewHelperArgumentList . '###';
         $subpart = HtmlParser::getSubpart($content, $subpartMarker);
         $viewHelperArguments = explode('|', $viewHelperArgumentList);
         $subpartTemplate = clone $this;
         $subpartTemplate->setWorkingTemplateContent($subpart);
         $viewHelper->setTemplate($subpartTemplate);
         try {
             $viewHelperContent = $viewHelper->execute($viewHelperArguments);
         } catch (\UnexpectedValueException $e) {
             if ($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['logging.']['exceptions']) {
                 GeneralUtility::devLog('Exception while rendering a viewhelper', 'solr', 3, array($e->__toString()));
             }
             $viewHelperContent = '';
         }
         $content = HtmlParser::substituteSubpart($content, $subpartMarker, $viewHelperContent, FALSE);
         // there might be more occurrences of the same subpart maker with
         // the same arguments but different markup to be used...
         // that's the case with the facet subpart view helper f.e.
         $furtherOccurrences = strpos($content, $subpartMarker);
         if ($furtherOccurrences !== FALSE) {
             $content = $this->renderSubpartViewHelper($viewHelper, $helperKey, $content);
         }
     }
     return $content;
 }
Exemple #2
0
 /**
  * Renders subpart view helpers.
  *
  * @param SubpartViewHelper $viewHelper View helper instance to execute.
  * @param string $helperKey The view helper marker key.
  * @param string $content Markup that contains the unsubstituted view helper subpart.
  * @return string Markup with the view helper replaced by the content it returned.
  */
 protected function renderSubpartViewHelper(SubpartViewHelper $viewHelper, $helperKey, $content)
 {
     $viewHelperArgumentLists = $this->getViewHelperArgumentLists($helperKey, $content);
     foreach ($viewHelperArgumentLists as $viewHelperArgumentList) {
         $subpartMarker = '###' . $helperKey . ':' . $viewHelperArgumentList . '###';
         $subpart = $this->getTemplateService()->getSubpart($content, $subpartMarker);
         $viewHelperArguments = explode('|', $viewHelperArgumentList);
         $subpartTemplate = clone $this;
         $subpartTemplate->setWorkingTemplateContent($subpart);
         $viewHelper->setTemplate($subpartTemplate);
         try {
             $viewHelperContent = $viewHelper->execute($viewHelperArguments);
         } catch (\UnexpectedValueException $e) {
             $configuration = Util::getSolrConfiguration();
             if ($configuration->getLoggingExceptions()) {
                 GeneralUtility::devLog('Exception while rendering a viewhelper', 'solr', 3, array($e->__toString()));
             }
             $viewHelperContent = '';
         }
         $content = $this->getTemplateService()->substituteSubpart($content, $subpartMarker, $viewHelperContent, false);
         // there might be more occurrences of the same subpart maker with
         // the same arguments but different markup to be used...
         // that's the case with the facet subpart view helper f.e.
         $furtherOccurrences = strpos($content, $subpartMarker);
         if ($furtherOccurrences !== false) {
             $content = $this->renderSubpartViewHelper($viewHelper, $helperKey, $content);
         }
     }
     return $content;
 }