/** * Preprocesses the preview rendering of a content element of type "script" * * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object * @param bool $drawItem Whether to draw the item using the default functionality * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * * @return void */ public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['CType'] === 'script') { $itemContent .= $this->getLanguageService()->sL(BackendUtility::getItemLabel('tt_content', 'select_key'), TRUE) . ' ' . $row['select_key'] . '<br />'; $itemContent .= '<br />' . $parentObject->linkEditContent($parentObject->renderText($row['bodytext']), $row) . '<br />'; $itemContent .= '<br />' . $parentObject->linkEditContent($parentObject->renderText($row['imagecaption']), $row) . '<br />'; $drawItem = FALSE; } }
/** * Preprocesses the preview rendering of a content element. * * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object * @param bool $drawItem Whether to draw the item using the default functionalities * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * @return void */ public function preProcess(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['CType'] === 'login') { $drawItem = false; $itemContent .= $parentObject->linkEditContent('<strong>' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:forms_login_title')) . '</strong>', $row); } }
/** * Preprocesses the preview rendering of a content element. * * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object * @param bool $drawItem Whether to draw the item using the default functionalities * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * @return void */ public function preProcess(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['CType'] === 'login') { $drawItem = FALSE; $itemContent .= $parentObject->linkEditContent('<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang_db_new_content_el.xlf:forms_login_title', TRUE) . '</strong>', $row); } }
/** * Preprocesses the preview rendering of a content element of type "mailform" * * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object * @param bool $drawItem Whether to draw the item using the default functionality * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * * @return void */ public function preProcess(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['CType'] === 'mailform') { $itemContent = $parentObject->linkEditContent($parentObject->renderText($row['bodytext']), $row) . '<br />'; $drawItem = false; } }
/** * Preprocesses the preview rendering of a content element of type "table" * * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object * @param bool $drawItem Whether to draw the item using the default functionality * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * * @return void */ public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['CType'] === 'table') { if ($row['table_content']) { $fieldDelimiter = $row['table_delimiter'] ? chr($row['table_delimiter']) : ','; $fieldEnclosure = $row['table_enclosure'] ? chr($row['table_enclosure']) : '"'; $maximumColumns = $row['cols'] ? $row['cols'] : 0; $tableData = CsvUtility::csvToArray($row['table_content'], $fieldDelimiter, $fieldEnclosure, (int) $maximumColumns); $linkedContent = ''; if ($tableData > 0) { $tableRows = ''; foreach ($tableData as $tableRow) { if ($tableRow > 0) { $tableColumns = ''; foreach ($tableRow as $tableColumn) { $tableColumns .= '<td>' . $tableColumn . '</td>'; } $tableRows .= '<tr>' . $tableColumns . '</tr>'; } } $linkedContent = '<table class="table table-striped table-bordered">' . $tableRows . '</table>'; } $itemContent .= $parentObject->linkEditContent($linkedContent, $row); } } }
/** * Preprocesses the preview rendering of a content element of type "mailform" * * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object * @param bool $drawItem Whether to draw the item using the default functionality * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * * @return void */ public function preProcess(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['CType'] === 'mailform') { $contentType = $parentObject->CType_labels[$row['CType']]; $itemContent = $parentObject->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />'; $drawItem = false; } }
/** * Preprocesses the preview rendering of a content element of type "website_gallery" * * @param PageLayoutView $parentObject Calling parent object * @param bool $drawItem Whether to draw the item using the default functionality * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * * @return void */ public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['CType'] === 'website_gallery') { if ($row['media']) { $itemContent .= $parentObject->linkEditContent($parentObject->getThumbCodeUnlinked($row, 'tt_content', 'media'), $row); } $drawItem = FALSE; } }
/** * Preprocesses the preview rendering of a content element of type "textmedia" * * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object * @param bool $drawItem Whether to draw the item using the default functionality * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * * @return void */ public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['CType'] === 'textmedia') { if ($row['bodytext']) { $itemContent .= $parentObject->linkEditContent($parentObject->renderText($row['bodytext']), $row) . '<br />'; } if ($row['assets']) { $itemContent .= $parentObject->linkEditContent($parentObject->getThumbCodeUnlinked($row, 'tt_content', 'assets'), $row) . '<br />'; $fileReferences = BackendUtility::resolveFileReferences('tt_content', 'assets', $row); if (!empty($fileReferences)) { $linkedContent = ''; foreach ($fileReferences as $fileReference) { $linkedContent .= htmlspecialchars($fileReference->getDescription()) . '<br />'; } $itemContent .= $parentObject->linkEditContent($linkedContent, $row); unset($linkedContent); } } $drawItem = false; } }
/** * Preprocesses the preview rendering of the content element "image". * * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object * @param bool $drawItem Whether to draw the item using the default functionalities * @param string $headerContent Header content * @param string $itemContent Item content * @param array $row Record row of tt_content * @return void */ public function preProcess(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { if ($row['CType'] === 'image') { if ($row['image']) { $itemContent .= $parentObject->linkEditContent($parentObject->getThumbCodeUnlinked($row, 'tt_content', 'image'), $row); $fileReferences = \TYPO3\CMS\Backend\Utility\BackendUtility::resolveFileReferences('tt_content', 'image', $row); if (!empty($fileReferences)) { $linkedContent = ''; foreach ($fileReferences as $fileReference) { $description = $fileReference->getDescription(); if ($description !== NULL && $description !== '') { $linkedContent .= htmlspecialchars($description) . '<br />'; } } $itemContent .= $parentObject->linkEditContent($linkedContent, $row); unset($linkedContent); } } $drawItem = FALSE; } }
/** * Modifies the Element to disable Dragging for cols * * @param tx_cms_layout $parentObject: Calling parent object * @param boolean $drawItem: Whether to draw the item using the default functionalities * @param string $headerContent: Header content * @param string $itemContent: Item content * @param array $row: Record row of tt_content * @return void */ private function renderPreview(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { // Preview of content_designer elements $expr = '/^' . $this->prefix . '(.*)$/si'; if (preg_match($expr, $row['CType'], $match)) { // Load the TypoScript Config $config = array('row' => &$row); $typoScript = TypoScript::loadConfig($config, substr($this->prefix, 0, strlen($this->prefix) - 1), $row['pid']); $this->typoScript = $typoScript[$row['CType']]; unset($typoScript, $config); // Render the preview with default labels etc.? (default is now off) $drawItem = $this->typoScript['settings.']['enableDefaultDrawItem'] == 1 ? TRUE : FALSE; // Render the preview if (empty($this->settings['renderMethod']) || !isset($this->settings['renderMethod'])) { $this->settings['renderMethod'] = 'flexForm'; } if ($this->typoScript['settings.']['renderMethod'] == 'tca') { $previewRenderer = GeneralUtility::makeInstance(\KERN23\ContentDesigner\Utility\DrawItem\Tca::class); } else { $previewRenderer = GeneralUtility::makeInstance(\KERN23\ContentDesigner\Utility\DrawItem\FlexForm::class); } $previewRenderer->getContentElementPreview($this->typoScript, $row, $headerContent, $itemContent); // Link the preview content $itemContent = $parentObject->linkEditContent($itemContent, $row); } }