/** * 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. * * @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 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 "multimedia" * * @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'] === 'multimedia' && $row['multimedia']) { $itemContent .= $parentObject->renderText($row['multimedia']) . '<br />'; $itemContent .= $parentObject->renderText($row['parameters']) . '<br />'; $drawItem = false; } }
/** * 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 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 "fsc_slider" * * @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'] === 'fsc_slider') { $itemContent .= '<h3>Fluid Styled Slider</h3>'; if ($row['assets']) { $itemContent .= $parentObject->thumbCode($row, 'tt_content', 'assets') . '<br />'; } $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); } }
/** * 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; } }
/** * 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['media']) { $itemContent .= $parentObject->thumbCode($row, 'tt_content', 'media') . '<br />'; $fileReferences = BackendUtility::resolveFileReferences('tt_content', 'media', $row); if (!empty($fileReferences)) { $linkedContent = ''; foreach ($fileReferences as $fileReference) { $linkedContent .= htmlspecialchars($fileReference->getDescription()) . '<br />'; } $itemContent .= $parentObject->linkEditContent($linkedContent, $row); unset($linkedContent); } } $drawItem = false; } }
/** * Renders the HTML code for a single tt_content element * * @param PageLayoutView $parentObject : The parent object that triggered this hook * @param array $itemRow : The data row to be rendered as HTML * * @return string */ public function renderSingleElementHTML(PageLayoutView $parentObject, $itemRow) { $singleElementHTML = $parentObject->tt_content_drawHeader($itemRow, $parentObject->tt_contentConfig['showInfo'] ? 15 : 5, $parentObject->defLangBinding && $parentObject->lP > 0, TRUE); $isRTE = $parentObject->RTE && $parentObject->isRTEforField('tt_content', $itemRow, 'bodytext'); $singleElementHTML .= '<div ' . (!empty($itemRow['_ORIG_uid']) ? ' class="ver-element"' : '') . '><div class="t3-page-ce-body-inner t3-page-ce-body-inner-' . $itemRow['CType'] . '">' . $parentObject->tt_content_drawItem($itemRow, $isRTE) . '</div></div>'; $footerContent = ''; // Get processed values: $info = array(); $parentObject->getProcessedValue('tt_content', 'starttime,endtime,fe_group,spaceBefore,spaceAfter', $itemRow, $info); // Display info from records fields: if (count($info)) { $footerContent = '<div class="t3-page-ce-info"> ' . implode('<br />', $info) . ' </div>'; } // Wrap it if (!empty($footerContent)) { $singleElementHTML .= '<div class="t3-page-ce-footer">' . $footerContent . '</div>'; } return $singleElementHTML; }
/** * @param PageLayoutView $view * @return PageLayoutView */ protected function configurePageLayoutViewForLanguageMode(PageLayoutView $view) { // Initializes page languages and icons so they are available in PageLayoutView if languageMode is set. $view->initializeLanguages(); $modSettings = $this->getPageModuleSettings(); if (2 === intval($modSettings['function'])) { $view->tt_contentConfig['single'] = 0; $view->tt_contentConfig['languageMode'] = 1; $view->tt_contentConfig['languageCols'] = array(0 => $this->getLanguageService()->getLL('m_default')); $view->tt_contentConfig['languageColsPointer'] = $modSettings['language']; } return $view; }
/** * Now the query gets enhanced by the "l18n_parent" pointer. This results in fetching * not only L=0 and L=-1 records but native foreign language records as well. * * This method mainly gets used by the PageLayout itself. * * @param string $table UNUSED (will always be queried from tt_content) * @param integer $id Page Id to be used (not used at all, but part of the API, see $this->pidSelect) * @param array $columns colPos values to be considered to be shown * @param string $additionalWhereClause Additional where clause for database select * @return array Associative array for each column (colPos) */ protected function getContentRecordsPerColumn($table, $id, array $columns, $additionalWhereClause = '') { if (!$this->validModuleConfig()) { return parent::getContentRecordsPerColumn($table, $id, $columns, $additionalWhereClause); } if ($table !== 'table' || $this->getSelectedLanguage() === FALSE || $additionalWhereClause !== sprintf(' AND sys_language_uid IN (%d,-1)', $this->getSelectedLanguage())) { return parent::getContentRecordsPerColumn($table, $id, $columns, $additionalWhereClause); } return parent::getContentRecordsPerColumn($table, $id, $columns, ' AND l18n_parent = 0' . $this->getLanguageRestrictionWhereClause()); }
/** * Renders the HTML code for a single tt_content element * * @param PageLayoutView $parentObject : The parent object that triggered this hook * @param array $itemRow : The data row to be rendered as HTML * * @return string */ public function renderSingleElementHTML(PageLayoutView $parentObject, $itemRow) { // @todo $parentObject->lP is gone, defLangBinding is proably not enough for the third param to act correctly $singleElementHTML = $parentObject->tt_content_drawHeader($itemRow, $parentObject->tt_contentConfig['showInfo'] ? 15 : 5, $parentObject->defLangBinding, true, true); $singleElementHTML .= '<div ' . (!empty($itemRow['_ORIG_uid']) ? ' class="ver-element"' : '') . '><div class="t3-page-ce-body-inner t3-page-ce-body-inner-' . $itemRow['CType'] . '">' . $parentObject->tt_content_drawItem($itemRow) . '</div></div>'; $footerContent = ''; // Get processed values: $info = array(); $parentObject->getProcessedValue('tt_content', 'starttime,endtime,fe_group,spaceBefore,spaceAfter', $itemRow, $info); // Display info from records fields: if (!empty($info)) { $footerContent = '<div class="t3-page-ce-info"> ' . implode('<br />', $info) . ' </div>'; } // Wrap it if (!empty($footerContent)) { $singleElementHTML .= '<div class="t3-page-ce-footer">' . $footerContent . '</div>'; } return $singleElementHTML; }