38 $this->templateService = GeneralUtility::makeInstance(MarkerBasedTemplateService::class);
39 parent::__construct(
$cObj);
49 public function render($conf = [])
54 $markerWrap = isset($conf[
'markerWrap.']) ? $this->cObj->stdWrap($conf[
'markerWrap'], $conf[
'markerWrap.']) : $conf[
'markerWrap'];
56 $markerWrap =
'### | ###';
58 list($PRE, $POST) = explode(
'|', $markerWrap);
62 $content = $this->cObj->cObjGetSingle($conf[
'template'], $conf[
'template.'],
'template');
63 $workOnSubpart = isset($conf[
'workOnSubpart.']) ? $this->cObj->stdWrap($conf[
'workOnSubpart'], $conf[
'workOnSubpart.']) : $conf[
'workOnSubpart'];
65 $content = $this->templateService->getSubpart($content, $PRE . $workOnSubpart . $POST);
68 if ($conf[
'relPathPrefix']) {
69 $htmlParser = GeneralUtility::makeInstance(HtmlParser::class);
70 $content = $htmlParser->prefixResourcePath($conf[
'relPathPrefix'], $content, $conf[
'relPathPrefix.']);
73 $nonCachedSubst = isset($conf[
'nonCachedSubst.']) ? $this->cObj->stdWrap($conf[
'nonCachedSubst'], $conf[
'nonCachedSubst.']) : $conf[
'nonCachedSubst'];
75 if ($nonCachedSubst) {
77 if (is_array($conf[
'marks.'])) {
78 foreach ($conf[
'marks.'] as $theKey => $theValue) {
79 if (!strstr($theKey,
'.')) {
80 $content = str_replace($PRE . $theKey . $POST, $this->cObj->cObjGetSingle($theValue, $conf[
'marks.'][$theKey .
'.'],
'marks.' . $theKey), $content);
85 if (is_array($conf[
'subparts.'])) {
86 foreach ($conf[
'subparts.'] as $theKey => $theValue) {
87 if (!strstr($theKey,
'.')) {
88 $subpart = $this->templateService->getSubpart($content, $PRE . $theKey . $POST);
90 $this->cObj->setCurrentVal($subpart);
91 $content = $this->templateService->substituteSubpart($content, $PRE . $theKey . $POST, $this->cObj->cObjGetSingle($theValue, $conf[
'subparts.'][$theKey .
'.'],
'subparts.' . $theKey),
true);
97 if (is_array($conf[
'wraps.'])) {
98 foreach ($conf[
'wraps.'] as $theKey => $theValue) {
99 if (!strstr($theKey,
'.')) {
100 $subpart = $this->templateService->getSubpart($content, $PRE . $theKey . $POST);
102 $this->cObj->setCurrentVal($subpart);
103 $content = $this->templateService->substituteSubpart($content, $PRE . $theKey . $POST, explode(
'|', $this->cObj->cObjGetSingle($theValue, $conf[
'wraps.'][$theKey .
'.'],
'wraps.' . $theKey)),
true);
111 if (is_array($conf[
'subparts.'])) {
112 foreach ($conf[
'subparts.'] as $theKey => $theValue) {
113 if (!strstr($theKey,
'.')) {
114 $subpart = $this->templateService->getSubpart($content, $PRE . $theKey . $POST);
116 $GLOBALS[
'TSFE']->register[
'SUBPART_' . $theKey] = $subpart;
117 $subparts[$theKey][
'name'] = $theValue;
118 $subparts[$theKey][
'conf'] = $conf[
'subparts.'][$theKey .
'.'];
124 if (is_array($conf[
'marks.'])) {
125 foreach ($conf[
'marks.'] as $theKey => $theValue) {
126 if (!strstr($theKey,
'.')) {
127 $marks[$theKey][
'name'] = $theValue;
128 $marks[$theKey][
'conf'] = $conf[
'marks.'][$theKey .
'.'];
133 if (is_array($conf[
'wraps.'])) {
134 foreach ($conf[
'wraps.'] as $theKey => $theValue) {
135 if (!strstr($theKey,
'.')) {
136 $wraps[$theKey][
'name'] = $theValue;
137 $wraps[$theKey][
'conf'] = $conf[
'wraps.'][$theKey .
'.'];
143 foreach ($subparts as $theKey => $theValue) {
145 $this->cObj->data[$this->cObj->currentValKey] =
$GLOBALS[
'TSFE']->register[
'SUBPART_' . $theKey];
147 $subpartArray[$PRE . $theKey . $POST] = $this->cObj->cObjGetSingle($theValue[
'name'], $theValue[
'conf'],
'subparts.' . $theKey);
150 $this->cObj->data[$this->cObj->currentValKey] =
'';
153 foreach ($marks as $theKey => $theValue) {
154 $markerArray[$PRE . $theKey . $POST] = $this->cObj->cObjGetSingle($theValue[
'name'], $theValue[
'conf'],
'marks.' . $theKey);
158 foreach ($wraps as $theKey => $theValue) {
159 $subpartWraps[$PRE . $theKey . $POST] = explode(
'|', $this->cObj->cObjGetSingle($theValue[
'name'], $theValue[
'conf'],
'wraps.' . $theKey));
162 $substMarksSeparately = isset($conf[
'substMarksSeparately.']) ? $this->cObj->stdWrap($conf[
'substMarksSeparately'], $conf[
'substMarksSeparately.']) : $conf[
'substMarksSeparately'];
163 if ($substMarksSeparately) {
164 $content = $this->templateService->substituteMarkerArrayCached($content, [], $subpartArray, $subpartWraps);
165 $content = $this->templateService->substituteMarkerArray($content, $markerArray);
167 $content = $this->templateService->substituteMarkerArrayCached($content, $markerArray, $subpartArray, $subpartWraps);
171 if (isset($conf[
'stdWrap.'])) {
172 $content = $this->cObj->stdWrap($content, $conf[
'stdWrap.']);