Initial commit - Typo3 11.5.41

This commit is contained in:
Matteo Gallo
2026-07-03 17:53:31 +02:00
commit 5ca4743197
6811 changed files with 568848 additions and 0 deletions

View File

@@ -0,0 +1,429 @@
<?php
namespace PwTeaserTeam\PwTeaser\Controller;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
* Tim Klein-Hitpass <tim.klein-hitpass@diemedialen.de>
* Kai Ratzeburg <kai.ratzeburg@diemedialen.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
* Controller for the teaser object
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class TeaserController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
/**
* @var array
*/
protected $settings = [];
/**
* @var integer
*/
protected $currentPageUid = null;
/**
* @var \PwTeaserTeam\PwTeaser\Domain\Repository\PageRepository
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $pageRepository;
/**
* @var \PwTeaserTeam\PwTeaser\Domain\Repository\ContentRepository
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $contentRepository;
/**
* @var \TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $categoryRepository;
/**
* @var \PwTeaserTeam\PwTeaser\Utility\Settings
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $settingsUtility;
/**
* @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
*/
protected $contentObject = null;
/**
* @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $signalSlotDispatcher;
/**
* @var \TYPO3\CMS\Fluid\View\TemplateView
*/
protected $view;
/**
* @var array
*/
protected $viewSettings = [];
/**
* Initialize Action will performed before each action will be executed
*
* @return void
*/
public function initializeAction()
{
$this->settings = $this->settingsUtility->renderConfigurationArray($this->settings);
$frameworkSettings = $this->configurationManager->getConfiguration(
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK
);
$viewSettings = $frameworkSettings['view'];
$presets = $viewSettings['presets'];
unset($viewSettings['presets']);
$this->viewSettings = $this->settingsUtility->renderConfigurationArray($viewSettings, 'view.');
$this->viewSettings['presets'] = $presets;
}
/**
* Displays teasers
*
* @return void
*/
public function indexAction()
{
$this->currentPageUid = $GLOBALS['TSFE']->id;
$this->performTemplatePathAndFilename();
$this->setOrderingAndLimitation();
$this->performPluginConfigurations();
switch ($this->settings['source']) {
default:
case 'thisChildren':
$rootPageUids = $this->currentPageUid;
$pages = $this->pageRepository->findByPid($this->currentPageUid);
break;
case 'thisChildrenRecursively':
$rootPageUids = $this->currentPageUid;
$pages = $this->pageRepository->findByPidRecursively(
$this->currentPageUid,
(int)$this->settings['recursionDepthFrom'],
(int)$this->settings['recursionDepth']
);
break;
case 'custom':
$rootPageUids = $this->settings['customPages'];
$pages = $this->pageRepository->findByPidList(
$this->settings['customPages'],
$this->settings['orderByPlugin']
);
break;
case 'customChildren':
$rootPageUids = $this->settings['customPages'];
$pages = $this->pageRepository->findChildrenByPidList($this->settings['customPages']);
break;
case 'customChildrenRecursively':
$rootPageUids = $this->settings['customPages'];
$pages = $this->pageRepository->findChildrenRecursivelyByPidList(
$this->settings['customPages'],
(int)$this->settings['recursionDepthFrom'],
(int)$this->settings['recursionDepth']
);
break;
}
if ($this->settings['pageMode'] !== 'nested') {
$pages = $this->performSpecialOrderings($pages);
}
/** @var $page \PwTeaserTeam\PwTeaser\Domain\Model\Page */
foreach ($pages as $page) {
if ($page->getUid() === $this->currentPageUid) {
$page->setIsCurrentPage(true);
}
// Load contents if enabled in configuration
if ($this->settings['loadContents'] == '1') {
$page->setContents($this->contentRepository->findByPid($page->getUid()));
}
}
if ($this->settings['pageMode'] === 'nested') {
$pages = $this->convertFlatToNestedPagesArray($pages, $rootPageUids);
}
$this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'ModifyPages', [&$pages, $this]);
$this->view->assign('pages', $pages);
}
/**
* Function to sort given pages by recursiveRootLineOrdering string
*
* @param \PwTeaserTeam\PwTeaser\Domain\Model\Page $a
* @param \PwTeaserTeam\PwTeaser\Domain\Model\Page $b
* @return integer
*/
protected function sortByRecursivelySorting(
\PwTeaserTeam\PwTeaser\Domain\Model\Page $a,
\PwTeaserTeam\PwTeaser\Domain\Model\Page $b
) {
if ($a->getRecursiveRootLineOrdering() == $b->getRecursiveRootLineOrdering()) {
return 0;
}
return ($a->getRecursiveRootLineOrdering() < $b->getRecursiveRootLineOrdering()) ? -1 : 1;
}
/**
* Sets ordering and limitation settings from $this->settings
*
* @return void
*/
protected function setOrderingAndLimitation()
{
if (!empty($this->settings['orderBy'])) {
if ($this->settings['orderBy'] === 'customField') {
$this->pageRepository->setOrderBy($this->settings['orderByCustomField']);
} else {
$this->pageRepository->setOrderBy($this->settings['orderBy']);
}
}
if (!empty($this->settings['orderDirection'])) {
$this->pageRepository->setOrderDirection($this->settings['orderDirection']);
}
if (!empty($this->settings['limit']) && $this->settings['orderBy'] !== 'random') {
$this->pageRepository->setLimit(intval($this->settings['limit']));
}
}
/**
* Sets the fluid template to file if file is selected in flexform
* configuration and file exists
*
* @return boolean Returns TRUE if templateType is file and exists,
* otherwise returns FALSE
*/
protected function performTemplatePathAndFilename()
{
$templateType = $this->viewSettings['templateType'];
$templateFile = $this->viewSettings['templateRootFile'];
$layoutRootPaths = $this->viewSettings['layoutRootPaths'] ?: [$this->viewSettings['layoutRootPath'] ?: null];
$partialRootPaths = $this->viewSettings['partialRootPaths'] ?: [$this->viewSettings['partialRootPath'] ?: null];
$templateRootPaths = $this->viewSettings['templateRootPaths'] ?: [$this->viewSettings['templateRootPath'] ?: null];
$preset = $this->viewSettings['templatePreset'] ?? null;
if ($templateType === 'preset' && !empty($preset)) {
$currentPreset = $this->viewSettings['presets'][$preset];
if (array_key_exists('partialRootPaths', $currentPreset) && !empty($currentPreset['partialRootPaths'])) {
$partialRootPaths = $currentPreset['partialRootPaths'];
}
if (array_key_exists('layoutRootPaths', $currentPreset) && !empty($currentPreset['layoutRootPaths'])) {
$layoutRootPaths = $currentPreset['layoutRootPaths'];
}
$templateType = 'file';
$templateFile = $currentPreset['templateRootFile'];
}
if ($templateType !== 'preset' && $templateRootPaths !== [null] && !empty($templateRootPaths)) {
if (!file_exists(GeneralUtility::getFileAbsFileName(reset($templateRootPaths)))) {
throw new \Exception('Template folder "' . reset($templateRootPaths) . '" not found!');
}
$this->view->setTemplateRootPaths($templateRootPaths);
}
if ($layoutRootPaths !== [null] && !empty($layoutRootPaths)) {
if (!file_exists(GeneralUtility::getFileAbsFileName(reset($layoutRootPaths)))) {
throw new \Exception('Layout folder "' . reset($layoutRootPaths) . '" not found!');
}
$this->view->setLayoutRootPaths($layoutRootPaths);
}
if ($partialRootPaths !== [null] && !empty($partialRootPaths)) {
if (!file_exists(GeneralUtility::getFileAbsFileName(reset($partialRootPaths)))) {
throw new \Exception('Partial folder "' . reset($partialRootPaths) . '" not found!');
}
$this->view->setPartialRootPaths($partialRootPaths);
}
if ($templateType === 'file' &&
!empty($templateFile) &&
file_exists(GeneralUtility::getFileAbsFileName($templateFile))
) {
$this->view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateFile));
return true;
}
$templatePathAndFilename = $this->viewSettings['templatePathAndFilename'] ?? '';
if ($templateType === null && !empty($templatePathAndFilename)
&& file_exists(GeneralUtility::getFileAbsFileName($templatePathAndFilename))) {
$this->view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templatePathAndFilename));
return true;
}
return false;
}
/**
* Performs configurations from plugin settings (flexform)
*
* @return void
*/
protected function performPluginConfigurations()
{
// Set ShowNavHiddenItems to TRUE
$this->pageRepository->setShowNavHiddenItems(($this->settings['showNavHiddenItems'] == '1'));
$this->pageRepository->setFilteredDokType(
GeneralUtility::trimExplode(
',',
$this->settings['showDoktypes'],
true
)
);
if ($this->settings['hideCurrentPage'] == '1') {
$this->pageRepository->setIgnoreOfUid($this->currentPageUid);
}
if ($this->settings['ignoreUids']) {
$ignoringUids = GeneralUtility::trimExplode(',', $this->settings['ignoreUids'], true);
array_map([$this->pageRepository, 'setIgnoreOfUid'], $ignoringUids);
}
if ($this->settings['categoriesList'] && $this->settings['categoryMode']) {
$categories = [];
foreach (GeneralUtility::intExplode(',', $this->settings['categoriesList'], true) as $categoryUid) {
$categories[] = $this->categoryRepository->findByUid($categoryUid);
}
switch ((int)$this->settings['categoryMode']) {
case \PwTeaserTeam\PwTeaser\Domain\Repository\PageRepository::CATEGORY_MODE_OR:
case \PwTeaserTeam\PwTeaser\Domain\Repository\PageRepository::CATEGORY_MODE_OR_NOT:
$isAnd = false;
break;
default:
$isAnd = true;
}
switch ((int)$this->settings['categoryMode']) {
case \PwTeaserTeam\PwTeaser\Domain\Repository\PageRepository::CATEGORY_MODE_AND_NOT:
case \PwTeaserTeam\PwTeaser\Domain\Repository\PageRepository::CATEGORY_MODE_OR_NOT:
$isNot = true;
break;
default:
$isNot = false;
}
$this->pageRepository->addCategoryConstraint($categories, $isAnd, $isNot);
}
if ($this->settings['source'] === 'custom') {
$this->settings['pageMode'] = 'flat';
}
if ($this->settings['pageMode'] === 'nested') {
$this->settings['recursionDepthFrom'] = 0;
$this->settings['orderBy'] = 'uid';
$this->settings['limit'] = 0;
}
}
/**
* Performs special orderings like "random" or "sorting"
*
* @param array <Pages> $pages
* @return array
*/
protected function performSpecialOrderings(array $pages)
{
// Make random if selected on queryResult, cause Extbase doesn't support it
if ($this->settings['orderBy'] === 'random') {
shuffle($pages);
if (!empty($this->settings['limit'])) {
$pages = array_slice($pages, 0, $this->settings['limit']);
}
}
if ($this->settings['orderBy'] === 'sorting' && strpos($this->settings['source'], 'Recursively') !== false) {
usort($pages, [$this, 'sortByRecursivelySorting']);
if (strtolower($this->settings['orderDirection']) === strtolower(QueryInterface::ORDER_DESCENDING)) {
$pages = array_reverse($pages);
}
if (!empty($this->settings['limit'])) {
$pages = array_slice($pages, 0, $this->settings['limit']);
return $pages;
}
return $pages;
}
return $pages;
}
/**
* Converts given pages array (flat) to nested one
*
* @param array <Pages> $pages
* @param string $rootPageUids Comma separated list of page uids
* @return array<Pages>
*/
protected function convertFlatToNestedPagesArray($pages, $rootPageUids)
{
$rootPageUidArray = GeneralUtility::intExplode(',', $rootPageUids);
$rootPages = [];
foreach ($rootPageUidArray as $rootPageUid) {
$page = $this->pageRepository->findByUid($rootPageUid);
$this->fillChildPagesRecursivley($page, $pages);
$rootPages[] = $page;
}
return $rootPages;
}
/**
* Fills given parentPage's childPages attribute recursively with pages
*
* @param \PwTeaserTeam\PwTeaser\Domain\Model\Page $parentPage
* @param array $pages
* @return \PwTeaserTeam\PwTeaser\Domain\Model\Page
*/
protected function fillChildPagesRecursivley($parentPage, array $pages)
{
$childPages = [];
/** @var $page \PwTeaserTeam\PwTeaser\Domain\Model\Page */
foreach ($pages as $page) {
if ($page->getPid() === $parentPage->getUid()) {
$this->fillChildPagesRecursivley($page, $pages);
$childPages[$page->getSorting()] = $page;
}
}
ksort($childPages);
$parentPage->setChildPages(array_values($childPages));
return $parentPage;
}
}

View File

@@ -0,0 +1,323 @@
<?php
namespace PwTeaserTeam\PwTeaser\Domain\Model;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
* Tim Klein-Hitpass <tim.klein-hitpass@diemedialen.de>
* Kai Ratzeburg <kai.ratzeburg@diemedialen.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Domain\Model\Category;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use TYPO3\CMS\Frontend\Page\PageRepository;
/**
* Content model
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class Content extends AbstractEntity
{
/**
* ctype
*
* @var string
*/
protected $ctype;
/**
* colPos
*
* @var integer
*/
protected $colPos;
/**
* header
*
* @var string
*/
protected $header;
/**
* bodytext
*
* @var string
*/
protected $bodytext;
/**
* It may contain multiple images, but TYPO3 called this field just "image"
*
* @var ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/
protected $image;
/**
* Categories
*
* @var ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category>
*/
protected $categories;
/**
* Complete row (from database) of this content element
*
* @var array
*/
protected $contentRow;
/**
* Constructor
*/
public function __construct()
{
$this->image = new ObjectStorage();
}
/**
* Setter for images
*
* @param ObjectStorage $image
* @return void
*/
public function setImage(ObjectStorage $image)
{
$this->image = $image;
}
/**
* Getter for images
*
* @return ObjectStorage images
*/
public function getImage()
{
return $this->image;
}
/**
* Add image
*
* @param FileReference $image
* @return void
*/
public function addImage(FileReference $image)
{
$this->image->attach($image);
}
/**
* Remove image
*
* @param FileReference $image
* @return void
*/
public function removeImage(FileReference $image)
{
$this->image->detach($image);
}
/**
* Returns image files as array (with all attributes)
*
* @return array
*/
public function getImageFiles()
{
$imageFiles = [];
/** @var FileReference $image */
foreach ($this->getImage() as $image) {
$imageFiles[] = $image->getOriginalResource()->toArray();
}
return $imageFiles;
}
/**
* Setter for bodytext
*
* @param string $bodytext bodytext
* @return void
*/
public function setBodytext($bodytext)
{
$this->bodytext = $bodytext;
}
/**
* Getter for bodytext
*
* @return string bodytext
*/
public function getBodytext()
{
return $this->bodytext;
}
/**
* Setter for ctype
*
* @param string $ctype ctype
* @return void
*/
public function setCtype($ctype)
{
$this->ctype = $ctype;
}
/**
* Getter for ctype
*
* @return string ctype
*/
public function getCtype()
{
return $this->ctype;
}
/**
* Setter for colPos
*
* @param integer $colPos colPos
* @return void
*/
public function setColPos($colPos)
{
$this->colPos = $colPos;
}
/**
* Getter for colPos
*
* @return integer colPos
*/
public function getColPos()
{
return $this->colPos;
}
/**
* Setter for header
*
* @param string $header header
* @return void
*/
public function setHeader($header)
{
$this->header = $header;
}
/**
* Getter for header
*
* @return string header
*/
public function getHeader()
{
return $this->header;
}
/**
* Getter for categories
*
* @return ObjectStorage
*/
public function getCategories()
{
return $this->categories;
}
/**
* Setter for categories
*
* @param ObjectStorage $categories
* @return void
*/
public function setCategories($categories)
{
$this->categories = $categories;
}
/**
* Add category
*
* @param Category $category
* @return void
*/
public function addCategory(Category $category)
{
$this->categories->attach($category);
}
/**
* Remove category
*
* @param Category $category
* @return void
*/
public function removeCategory(Category $category)
{
$this->categories->detach($category);
}
/**
* Checks for attribute in _contentRow
*
* @param string $name Name of unknown method
* @param array arguments Arguments of call
* @return mixed
*/
public function __call($name, $arguments)
{
if (substr(strtolower($name), 0, 3) == 'get' && strlen($name) > 3) {
$attributeName = lcfirst(substr($name, 3));
if (empty($this->contentRow)) {
/** @var PageRepository $pageSelect */
$pageSelect = $GLOBALS['TSFE']->sys_page;
$contentRow = $pageSelect->getRawRecord('tt_content', $this->getUid());
foreach ($contentRow as $key => $value) {
$this->contentRow[GeneralUtility::underscoredToLowerCamelCase($key)] = $value;
}
}
if (isset($this->contentRow[$attributeName])) {
return $this->contentRow[$attributeName];
}
}
}
/**
* Get raw content row
*
* @return array
*/
public function getContentRow()
{
return $this->contentRow;
}
}

View File

@@ -0,0 +1,922 @@
<?php
namespace PwTeaserTeam\PwTeaser\Domain\Model;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\RootlineUtility;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
* 2016 Tim Klein-Hitpass <tim.klein-hitpass@diemedialen.de>
* Kai Ratzeburg <kai.ratzeburg@diemedialen.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Page model
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class Page extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/** Translation constant: Show page always */
const L18N_SHOW_ALWAYS = 0;
/** Translation constant: Hide page on default language */
const L18N_HIDE_DEFAULT_LANGUAGE = 1;
/** Translation constant: Hide page on foreign language if no translation exists */
const L18N_HIDE_IF_NO_TRANSLATION_EXISTS = 2;
/** Translation constant: Hide page always, but show on foreign langauge if translation exists */
const L18N_HIDE_ALWAYS_BUT_TRANSLATION_EXISTS = 3;
/**
* doktype
*
* @var integer
*/
protected $doktype;
/**
* isCurrentPage
*
* @var boolean
*/
protected $isCurrentPage = false;
/**
* title
*
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $title;
/**
* subtitle
*
* @var string
*/
protected $subtitle;
/**
* navTitle
*
* @var string
*/
protected $navTitle;
/**
* meta keywords
*
* @var string
*/
protected $keywords;
/**
* meta description
*
* @var string
*/
protected $description;
/**
* abstract
*
* @var string
*/
protected $abstract;
/**
* alias
*
* @var string
*/
protected $alias;
/**
* media
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/
protected $media;
/**
* sorting
*
* @var integer
*/
protected $sorting;
/**
* creation date (crdate)
*
* @var integer
*/
protected $creationDate;
/**
* timestamp (tstamp)
*
* @var integer
*/
protected $tstamp;
/**
* lastUpdated
*
* @var integer
*/
protected $lastUpdated;
/**
* start time
*
* @var integer
*/
protected $starttime;
/**
* end time
*
* @var integer
*/
protected $endtime;
/**
* new until
*
* @var integer
*/
protected $newUntil;
/**
* author
*
* @var string
*/
protected $author;
/**
* author email
*
* @var string
*/
protected $authorEmail;
/**
* contents
*
* @var array<\PwTeaserTeam\PwTeaser\Domain\Model\Content>
*/
protected $contents;
/**
* Categories
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category>
*/
protected $categories;
/**
* @var integer
*/
protected $l18nConfiguration;
/**
* Child pages
*
* @var array<Page>
*/
protected $childPages = [];
/**
* Custom Attributes
* which can be set by hooks
*
* @var array<mixed>
*/
protected $customAttributes = [];
/**
* Complete row (from database) of this page
*
* @var array
*/
protected $pageRow = null;
/**
* @var \TYPO3\CMS\Core\Resource\FileRepository
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $fileRepository;
/**
* Sets a custom attribute
*
* @param string $key The name of the attribute
* @param mixed $value Attribute's value
*
* @return void
*/
public function setCustomAttribute($key, $value)
{
$this->customAttributes[$key] = $value;
}
/**
* Returns the value of a custom attribute
*
* @param string $key Name of attribute
* @return mixed The value of a custom attribute
*/
public function getCustomAttribute($key)
{
if (!empty($key) && $this->hasCustomAttribute($key)) {
return $this->customAttributes[$key];
}
return null;
}
/**
* Checks if given custom attribute has been set
*
* @param string $key
* @return bool
*/
public function hasCustomAttribute($key)
{
return isset($this->customAttributes[$key]);
}
/**
* @return array
*/
public function getGet(): array
{
if (empty($this->pageRow)) {
/** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageSelect */
$pageSelect = $GLOBALS['TSFE']->sys_page;
$pageRow = $pageSelect->getPage($this->getUid());
foreach ($pageRow as $key => $value) {
$this->pageRow[GeneralUtility::underscoredToLowerCamelCase($key)] = $value;
}
}
return array_merge($this->customAttributes, $this->pageRow);
}
/**
* Checks for attribute in _customAttributes and _pageRow
*
* @param string $name Name of unknown method
* @param array arguments Arguments of call
* @return mixed
* @deprecated Use getGet() instead (in fluid template: {page.get.attributeName})
*/
public function __call($name, $arguments)
{
if (substr(strtolower($name), 0, 3) === 'get' && strlen($name) > 3) {
$attributeName = lcfirst(substr($name, 3));
return $this->getGet()[$attributeName];
}
}
/**
* Constructor
*/
public function __construct()
{
$this->categories = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->media = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Setter for contents
*
* @param array <\PwTeaserTeam\PwTeaser\Domain\Model\Content> $contents array of contents
* @return void
*/
public function setContents($contents)
{
$this->contents = $contents;
}
/**
* Getter for contents
*
* @return array<\PwTeaserTeam\PwTeaser\Domain\Model\Content> contents
*/
public function getContents()
{
return $this->contents;
}
/**
* Getter for isCurrentPage
*
* @return boolean
*/
public function getIsCurrentPage()
{
return $this->isCurrentPage;
}
/**
* Setter for isCurrentPage
*
* @param boolean $isCurrentPage
* @return void
*/
public function setIsCurrentPage($isCurrentPage)
{
$this->isCurrentPage = $isCurrentPage;
}
/**
* Setter for authorEmail
*
* @param string $authorEmail authorEmail
* @return void
*/
public function setAuthorEmail($authorEmail)
{
$this->authorEmail = $authorEmail;
}
/**
* Getter for authorEmail
*
* @return string authorEmail
*/
public function getAuthorEmail()
{
return $this->authorEmail;
}
/**
* Setter for keywords
*
* @param string $keywords keywords
* @return void
*/
public function setKeywords($keywords)
{
$this->keywords = $keywords;
}
/**
* Getter for keywords
*
* @return array array of keywords
*/
public function getKeywords()
{
return (GeneralUtility::trimExplode(',', $this->keywords, true));
}
/**
* Getter for keywords. Returns a string
*
* @return string keywords as string
*/
public function getKeywordsAsString()
{
return $this->keywords;
}
/**
* Setter for description
*
* @param string $description description
* @return void
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* Getter for description
*
* @return string description
*/
public function getDescription()
{
return $this->description;
}
/**
* Setter for alias
*
* @param string $alias alias
* @return void
*/
public function setAlias($alias)
{
$this->alias = $alias;
}
/**
* Getter for alias
*
* @return string alias
*/
public function getAlias()
{
return $this->alias;
}
/**
* Setter for navTitle
*
* @param string $navTitle navTitle
* @return void
*/
public function setNavTitle($navTitle)
{
$this->navTitle = $navTitle;
}
/**
* Getter for navTitle
*
* @return string navTitle
*/
public function getNavTitle()
{
return $this->navTitle;
}
/**
* Setter for abstract
*
* @param string $abstract abstract
* @return void
*/
public function setAbstract($abstract)
{
$this->abstract = $abstract;
}
/**
* Getter for abstract
*
* @return string abstract
*/
public function getAbstract()
{
return $this->abstract;
}
/**
* Setter for subtitle
*
* @param string $subtitle subtitle
* @return void
*/
public function setSubtitle($subtitle)
{
$this->subtitle = $subtitle;
}
/**
* Getter for subtitle
*
* @return string subtitle
*/
public function getSubtitle()
{
return $this->subtitle;
}
/**
* Setter for title
*
* @param string $title title
* @return void
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Getter for title
*
* @return string title
*/
public function getTitle()
{
return $this->title;
}
/**
* Setter for media
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $media
* @return void
*/
public function setMedia(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $media)
{
$this->media = $media;
}
/**
* Getter for media (returns FileReference objects)
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/
public function getMedia()
{
return $this->media;
}
/**
* Add single medium
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $medium
* @return void
*/
public function addMedium(\TYPO3\CMS\Extbase\Domain\Model\FileReference $medium)
{
$this->media->attach($medium);
}
/**
* Removes single medium
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $medium
* @return void
*/
public function removeMedium(\TYPO3\CMS\Extbase\Domain\Model\FileReference $medium)
{
$this->media->detach($medium);
}
/**
* Returns media files as array (with all attributes)
*
* @return array
* @deprecated Use media attribute instead
*/
public function getMediaFiles()
{
GeneralUtility::deprecationLog(
'Please don\'t use {page.mediaFiles} anymore in your pw_teaser templates. Use {page.media} instead.'
);
return $this->getMedia()->toArray();
}
/**
* Setter for newUntil
*
* @param integer $newUntil newUntil
* @return void
*/
public function setNewUntil($newUntil)
{
$this->newUntil = $newUntil;
}
/**
* Getter for newUntil
*
* @return integer newUntil
*/
public function getNewUntil()
{
return $this->newUntil;
}
/**
* Return TRUE if the page is marked as new
*
* @return boolean TRUE if the page is marked as new, otherwise FALSE
*/
public function getIsNew()
{
if (!empty($this->newUntil) && $this->newUntil !== 0) {
return $this->newUntil < time();
}
return false;
}
/**
* Setter for creationDate (crdate)
*
* @param integer $creationDate creationDate
* @return void
*/
public function setCreationDate($creationDate)
{
$this->creationDate = $creationDate;
}
/**
* Getter for creationDate (crdate)
*
* @return integer creationDate
*/
public function getCreationDate()
{
return $this->creationDate;
}
/**
* Setter for tstamp
*
* @param integer $tstamp tstamp
* @return void
*/
public function setTstamp($tstamp)
{
$this->tstamp = $tstamp;
}
/**
* Getter for tstamp
*
* @return integer tstamp
*/
public function getTstamp()
{
return $this->tstamp;
}
/**
* Setter for lastUpdated
*
* @param integer $lastUpdated lastUpdated
* @return void
*/
public function setLastUpdated($lastUpdated)
{
$this->lastUpdated = $lastUpdated;
}
/**
* Getter for lastUpdated
*
* @return integer lastUpdated
*/
public function getLastUpdated()
{
return $this->lastUpdated;
}
/**
* Setter for starttime
*
* @param integer $starttime
* @return void
*/
public function setStarttime($starttime)
{
$this->starttime = $starttime;
}
/**
* Getter for starttime
*
* @return integer starttime
*/
public function getStarttime()
{
return $this->starttime;
}
/**
* Getter for endtime
*
* @return integer endtime
*/
public function getEndtime()
{
return $this->endtime;
}
/**
* Setter for endtime
*
* @param integer $endtime endtime
* @return void
*/
public function setEndtime($endtime)
{
$this->endtime = $endtime;
}
/**
* Getter for author
*
* @return string author
*/
public function getAuthor()
{
return $this->author;
}
/**
* Setter for author
*
* @param string $author author
* @return void
*/
public function setAuthor($author)
{
$this->author = $author;
}
/**
* Getter for doktype
*
* @return integer the doktype
*/
public function getDoktype()
{
return $this->doktype;
}
/**
* Setter for doktype
*
* @param integer $doktype the doktype
* @return void
*/
public function setDoktype($doktype)
{
$this->doktype = $doktype;
}
/**
* Getter for l18nConfiguration
*
* @return integer
*/
public function getL18nConfiguration()
{
return $this->l18nConfiguration;
}
/**
* Setter for l18nConfiguration
*
* @param integer $l18nCfg
* @return void
*/
public function setL18nConfiguration($l18nCfg)
{
$this->l18nConfiguration = $l18nCfg;
}
/**
* Getter for categories
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function getCategories()
{
return $this->categories;
}
/**
* Setter for categories
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $categories
* @return void
*/
public function setCategories($categories)
{
$this->categories = $categories;
}
/**
* Add category
*
* @param \TYPO3\CMS\Extbase\Domain\Model\Category $category
* @return void
*/
public function addCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category)
{
$this->categories->attach($category);
}
/**
* Remove category
*
* @param \TYPO3\CMS\Extbase\Domain\Model\Category $category
* @return void
*/
public function removeCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category)
{
$this->categories->detach($category);
}
/**
* Returns rootLine of this page
*
* @return array
*/
public function getRootLine()
{
$context = GeneralUtility::makeInstance(Context::class);
/** @var RootlineUtility $rootline */
$rootline = GeneralUtility::makeInstance(RootlineUtility::class, $this->getUid(), '', $context);
return $rootline->get();
}
/**
* Returns amount of parent pages, including this page itself.
* The root page (not id=0) got depth 1.
*
* @return integer
*/
public function getRootLineDepth()
{
return count($this->getRootLine());
}
/**
* Returns string of sortings of all root pages including this page.
*
* @return string String with orderings of this page and all root pages
*/
public function getRecursiveRootLineOrdering()
{
$recursiveOrdering = [];
foreach ($this->getRootLine() as $pageRootPart) {
array_unshift($recursiveOrdering, str_pad($pageRootPart['sorting'], 11, '0', STR_PAD_LEFT));
}
return implode('-', $recursiveOrdering);
}
/**
* Returns the complete page row (from database) as array
*
* @return array
*/
public function getPageRow()
{
return $this->pageRow;
}
/**
* Getter for sorting
*
* @return integer
*/
public function getSorting()
{
return $this->sorting;
}
/**
* Setter for sorting
*
* @param integer $sorting
* @return void
*/
public function setSorting($sorting)
{
$this->sorting = $sorting;
}
/**
* Getter for child pages
*
* @return array
*/
public function getChildPages()
{
return $this->childPages;
}
/**
* Setter for child pages
*
* @param array <Page> $childPages
* @return void
*/
public function setChildPages(array $childPages)
{
$this->childPages = $childPages;
}
}

View File

@@ -0,0 +1,94 @@
<?php
namespace PwTeaserTeam\PwTeaser\Domain\Repository;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
* 2016 Tim Klein-Hitpass <tim.klein-hitpass@diemedialen.de>
* Kai Ratzeburg <kai.ratzeburg@diemedialen.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Repository for Content model
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class ContentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
/**
* Initializes the repository.
*
* @return void
* @see \TYPO3\CMS\Extbase\Persistence\Repository::initializeObject()
*/
public function initializeObject()
{
/** @var \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings */
$querySettings = $this->objectManager->get('TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface');
$querySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($querySettings);
}
/**
* Returns all objects of this repository which matches the given pid. This
* overwritten method exists, to perform sorting
*
* @param integer $pid Pid to search for
* @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult All found objects, will be
* empty if there are no objects
*/
public function findByPid($pid)
{
$query = $this->createQuery();
$query->matching($query->equals('pid', $pid));
$query->setOrderings(
[
'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
]
);
return $query->execute();
}
/**
* Returns all objects of this repository which are located inside the
* given pages
*
* @param array <\PwTeaserTeam\PwTeaser\Domain\Model\Page> $pages Pages to get content elements
* @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult All found objects, will be
* empty if there are no objects
*/
public function findByPages($pages)
{
$query = $this->createQuery();
$constraint = [];
foreach ($pages as $page) {
$constraint[] = $query->equals('pid', $page->getUid());
}
$query->matching($query->logicalOr($constraint));
return $query->execute();
}
}

View File

@@ -0,0 +1,456 @@
<?php
namespace PwTeaserTeam\PwTeaser\Domain\Repository;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
* 2016 Tim Klein-Hitpass <tim.klein-hitpass@diemedialen.de>
* Kai Ratzeburg <kai.ratzeburg@diemedialen.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use PwTeaserTeam\PwTeaser\Domain\Model\Page;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Repository for Page model
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class PageRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
/** Category Mode: Or */
const CATEGORY_MODE_OR = 1;
/** Category Mode: And */
const CATEGORY_MODE_AND = 2;
/** Category Mode: Or Not */
const CATEGORY_MODE_OR_NOT = 3;
/** Category Mode: And Not */
const CATEGORY_MODE_AND_NOT = 4;
/**
* page attribute to order by
*
* @var string
*/
protected $orderBy = 'uid';
/**
* Direction to order. Default is ascending.
*
* @var string
*/
protected $orderDirection = \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING;
/**
* @var \TYPO3\CMS\Extbase\Persistence\QueryInterface
*/
protected $query = null;
/**
* @var array
*/
protected $queryConstraints = [];
/**
* Initializes the repository.
*
* @return void
* @see \TYPO3\CMS\Extbase\Persistence\Repository::initializeObject()
*/
public function initializeObject()
{
/** @var \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings */
$querySettings = $this->objectManager->get('TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface');
$querySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($querySettings);
$this->query = $this->createQuery();
}
/**
* Returns all objects of this repository which match the pid
*
* @param integer $pid the pid to search for
* @return array All found pages, will be empty if the result is empty
*/
public function findByPid($pid)
{
$this->addQueryConstraint($this->query->equals('pid', $pid));
return $this->executeQuery();
}
/**
* Returns all objects of this repository which are children of the matched
* pid (recursively)
*
* @param integer $pid the pid to search for recursively
* @param integer $recursionDepthFrom Start of recursion depth
* @param integer $recursionDepth Depth of recursion
* @return array All found pages, will be empty if the result is empty
*/
public function findByPidRecursively($pid, $recursionDepthFrom, $recursionDepth)
{
return $this->findChildrenRecursivelyByPidList($pid, $recursionDepthFrom, $recursionDepth);
}
/**
* Returns all objects of this repository which are in the pidlist
*
* @param string $pidlist comma seperated list of pids to search for
* @param boolean $orderByPlugin setting of ordering by plugin
* @return array All found pages, will be empty if the result is empty
*/
public function findByPidList($pidlist, $orderByPlugin = false)
{
$pagePids = GeneralUtility::intExplode(',', $pidlist, true);
// early return when list is empty to prevent sql exception
if (empty($pagePids)) {
return [];
}
$query = $this->query;
$this->addQueryConstraint($query->in('uid', $pagePids));
$query->matching($query->logicalAnd($this->queryConstraints));
if ($orderByPlugin == false) {
$this->handleOrdering($query);
$results = $query->execute();
$this->resetQuery();
return $this->handlePageLocalization($results);
} else {
$results = $query->execute();
$this->resetQuery();
return $this->orderByPlugin($pagePids, $this->handlePageLocalization($results));
}
}
/**
* Creates array of result items, with the order of given pagePids
*
* @param array $pagePids pagePids to order for
* @param array $results results to reorder
* @return array results ordered by plugin
*/
protected function orderByPlugin(array $pagePids, array $results)
{
$sortedResults = [];
foreach ($pagePids as $pagePid) {
foreach ($results as $result) {
if ($pagePid === $result->getUid()) {
$sortedResults[] = $result;
continue;
}
}
}
return $sortedResults;
}
/**
* Returns all objects of this repository which are in the pidlist
*
* @param string $pidlist comma seperated list of pids to search for
* @return array All found pages, will be empty if the result is empty
*/
public function findChildrenByPidList($pidlist)
{
$pagePids = GeneralUtility::intExplode(',', $pidlist, true);
// early return when list is empty to prevent sql exception
if (empty($pagePids)) {
return [];
}
$this->addQueryConstraint($this->query->in('pid', $pagePids));
return $this->executeQuery();
}
/**
* Returns all objects of this repository which are children of pages in the
* pidlist (recursively)
*
* @param string $pidlist comma seperated list of pids to search for
* @param integer $recursionDepthFrom Start level for recursion
* @param integer $recursionDepth Depth of recursion
* @return array All found pages, will be empty if the result is empty
*/
public function findChildrenRecursivelyByPidList($pidlist, $recursionDepthFrom, $recursionDepth)
{
$pagePids = $this->getRecursivePageList($pidlist, $recursionDepthFrom, $recursionDepth);
$this->addQueryConstraint($this->query->in(($recursionDepthFrom === 0) ? 'pid' : 'uid', $pagePids));
return $this->executeQuery();
}
/**
* Adds query constraint to array
*
* @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint Constraint to add
* @return void
*/
protected function addQueryConstraint(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint)
{
$this->queryConstraints[] = $constraint;
}
/**
* Add category constraint
*
* @param array $categories
* @param boolean $isAnd If TRUE categories get a logicalAnd. Otherwise a logicalOr.
* @param boolean $isNot If TRUE categories get a logicalNot operator. Otherwise not.
* @return void
*/
public function addCategoryConstraint(array $categories, $isAnd = true, $isNot = false)
{
if ($isAnd === true && $isNot === false) {
$this->queryConstraints[] = $this->query->logicalAnd($this->buildCategoryConstraint($categories));
}
if ($isAnd === true && $isNot === true) {
$this->queryConstraints[] = $this->query->logicalNot(
$this->query->logicalAnd(
$this->buildCategoryConstraint($categories)
)
);
}
if ($isAnd === false && $isNot === false) {
$this->queryConstraints[] = $this->query->logicalOr($this->buildCategoryConstraint($categories));
}
if ($isAnd === false && $isNot === true) {
$this->queryConstraints[] = $this->query->logicalNot(
$this->query->logicalOr(
$this->buildCategoryConstraint($categories)
)
);
}
}
/**
* Build category constraint for each category (contains)
*
* @param array $categories
* @return array
*/
protected function buildCategoryConstraint(array $categories)
{
$contraints = [];
foreach ($categories as $category) {
$contraints[] = $this->query->contains('categories', $category);
}
return $contraints;
}
/**
* Finalize given query constraints and executes the query
*
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface Result of query
*/
protected function executeQuery()
{
$query = $this->query;
$query->matching($query->logicalAnd($this->queryConstraints));
$this->handleOrdering($query);
$queryResult = $query->execute();
$this->resetQuery();
$queryResult = $this->handlePageLocalization($queryResult);
return $queryResult;
}
/**
* Handles page localization
*
* @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $pages
* @return array<\PwTeaserTeam\PwTeaser\Domain\Model\Page>
*/
protected function handlePageLocalization(\TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $pages)
{
/** @var Context $context */
$context = GeneralUtility::makeInstance(Context::class);
$currentLangUid = $context->getPropertyFromAspect('language', 'id');
$displayedPages = [];
/** @var Page $page */
foreach ($pages as $page) {
if ($currentLangUid === 0) {
if ($page->getL18nConfiguration() !== Page::L18N_HIDE_DEFAULT_LANGUAGE &&
$page->getL18nConfiguration() !== Page::L18N_HIDE_ALWAYS_BUT_TRANSLATION_EXISTS) {
$displayedPages[] = $page;
}
} else {
/** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageSelect */
$pageSelect = $GLOBALS['TSFE']->sys_page;
$pageRowWithOverlays = $pageSelect->getPage($page->getUid());
if ((boolean)$GLOBALS['TYPO3_CONF_VARS']['FE']['hidePagesIfNotTranslatedByDefault'] === false) {
if (!($page->getL18nConfiguration() === Page::L18N_HIDE_IF_NO_TRANSLATION_EXISTS ||
$page->getL18nConfiguration() === Page::L18N_HIDE_ALWAYS_BUT_TRANSLATION_EXISTS) ||
isset($pageRowWithOverlays['_PAGES_OVERLAY'])) {
$displayedPages[] = $page;
}
} else {
if (($page->getL18nConfiguration() === Page::L18N_HIDE_IF_NO_TRANSLATION_EXISTS ||
$page->getL18nConfiguration() === Page::L18N_HIDE_ALWAYS_BUT_TRANSLATION_EXISTS) &&
!isset($pageRowWithOverlays['_PAGES_OVERLAY']) ||
isset($pageRowWithOverlays['_PAGES_OVERLAY'])) {
$displayedPages[] = $page;
}
}
}
}
return $displayedPages;
}
/**
* Get subpages recursivley of given pid(s).
*
* @param string $pidlist List of pageUids to get subpages of. May contain a single uid.
* @param integer $recursionDepthFrom Start of recursion depth
* @param integer $recursionDepth Depth of recursion
* @return array Found subpages, recursivley
*/
protected function getRecursivePageList($pidlist, $recursionDepthFrom, $recursionDepth)
{
/** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer */
$contentObjectRenderer = GeneralUtility::makeInstance('TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
$pagePids = [];
$pids = GeneralUtility::intExplode(',', $pidlist, true);
foreach ($pids as $pid) {
$pageList = GeneralUtility::intExplode(
',',
$contentObjectRenderer->getTreeList($pid, $recursionDepth, $recursionDepthFrom),
true
);
$pagePids = array_merge($pagePids, $pageList);
if ($recursionDepthFrom === 0) {
array_unshift($pagePids, $pid);
}
}
return array_unique($pagePids);
}
/**
* Sets the order by which is used by all find methods
*
* @param string $orderBy property to order by
* @return void
*/
public function setOrderBy($orderBy)
{
if ($orderBy !== 'random') {
$this->orderBy = $orderBy;
}
}
/**
* Sets the order direction which is used by all find methods
*
* @param string $orderDirection the direction to order, may be desc or asc
* @return void
*/
public function setOrderDirection($orderDirection)
{
if ($orderDirection == 'desc' || $orderDirection == 1) {
$this->orderDirection = \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING;
} else {
$this->orderDirection = \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING;
}
}
/**
* Sets the query limit
*
* @param integer $limit The limit of elements to show
* @return void
*/
public function setLimit($limit)
{
$this->query->setLimit($limit);
}
/**
* Sets the nav_hide_state flag
*
* @param boolean $showNavHiddenItems If TRUE lets show items which should not be visible in navigation.
* Default is FALSE.
* @return void
*/
public function setShowNavHiddenItems($showNavHiddenItems)
{
if ($showNavHiddenItems === true) {
$this->addQueryConstraint($this->query->in('nav_hide', [0, 1]));
} else {
$this->addQueryConstraint($this->query->in('nav_hide', [0]));
}
}
/**
* Sets doktypes to filter for
*
* @param array $dokTypesToFilterFor doktypes as array, may be empty
* @return void
*/
public function setFilteredDokType(array $dokTypesToFilterFor)
{
if (count($dokTypesToFilterFor) > 0) {
$this->addQueryConstraint($this->query->in('doktype', $dokTypesToFilterFor));
}
}
/**
* Ignores given uid
*
* @param integer $currentPageUid Uid to ignore
* @return void
*/
public function setIgnoreOfUid($currentPageUid)
{
$this->addQueryConstraint($this->query->logicalNot($this->query->equals('uid', $currentPageUid)));
}
/**
* Adds handle of ordering to query object
*
* @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
* @return void
*/
protected function handleOrdering(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query)
{
$query->setOrderings([$this->orderBy => $this->orderDirection]);
}
/**
* Resets query and queryConstraints after execution
*
* @return void
*/
protected function resetQuery()
{
unset($this->query);
$this->query = $this->createQuery();
unset($this->queryConstraints);
$this->queryConstraints = [];
}
}

View File

@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
namespace PwTeaserTeam\PwTeaser\UserFunction;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Object\ObjectManager;
class ItemsProcFunc
{
public function getAvailableTemplatePresets(array &$parameters): void
{
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$configurationManager = $objectManager->get(ConfigurationManager::class);
$config = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$presets = $config['plugin.']['tx_pwteaser.']['view.']['presets.'] ?? [];
foreach ($presets as $key => $preset) {
$parameters['items'][] = [$preset['label'], rtrim($key, '.')];
}
}
}

View File

@@ -0,0 +1,140 @@
<?php
namespace PwTeaserTeam\PwTeaser\Utility;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
* Benjamin Schulte <benjamin.schulte@diemedialen.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* This class provides some methods to prepare and render given extension settings
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class Settings
{
/**
* @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
*/
protected $contentObject;
/**
* @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $configurationManager = null;
/**
* Initialize this settings utility
*
* @return void
*/
public function initializeObject()
{
$this->contentObject = $this->configurationManager->getContentObject();
}
/**
* Renders a given typoscript configuration and returns the whole array with
* calculated values.
*
* @param array $settings the typoscript configuration array
* @param string $section
* @return array the configuration array with the rendered typoscript
*/
public function renderConfigurationArray(array $settings, string $section = 'settings.')
{
$settings = $this->enhanceSettingsWithTypoScript($this->makeConfigurationArrayRenderable($settings), $section);
$result = [];
foreach ($settings as $key => $value) {
if (substr($key, -1) === '.') {
$keyWithoutDot = substr($key, 0, -1);
if (array_key_exists($keyWithoutDot, $settings)) {
$result[$keyWithoutDot] = $this->contentObject->cObjGetSingle($settings[$keyWithoutDot], $value);
} else {
$result[$keyWithoutDot] = $this->renderConfigurationArray($value);
}
} else {
if (!array_key_exists($key . '.', $settings)) {
$result[$key] = $value;
}
}
}
return $result;
}
/**
* Overwrite flexform values with typoscript if flexform value is empty and typoscript value exists.
*
* @param array $settings Settings from flexform
* @param string $section
* @param string $extKey
* @return array enhanced settings
*/
protected function enhanceSettingsWithTypoScript(
array $settings,
string $section = 'settings.',
string $extKey = 'tx_pwteaser'
) {
$typoscript = $this->configurationManager->getConfiguration(
\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT
);
$typoscript = $typoscript['plugin.'][$extKey . '.'][$section];
foreach ($settings as $key => $setting) {
if ($setting === '' && is_array($typoscript) && array_key_exists($key, $typoscript)) {
$settings[$key] = $typoscript[$key];
}
}
return $settings;
}
/**
* Formats a given array with typoscript syntax, recursively. After the
* transformation it can be rendered with cObjGetSingle.
*
* Example:
* Before: $array['level1']['level2']['finalLevel'] = 'hello kitty'
* After: $array['level1.']['level2.']['finalLevel'] = 'hello kitty'
* $array['level1'] = 'TEXT'
*
* @param array $configuration settings array to make renderable
* @return array the renderable settings
*/
protected function makeConfigurationArrayRenderable(array $configuration)
{
$dottedConfiguration = [];
foreach ($configuration as $key => $value) {
if (is_array($value)) {
if (array_key_exists('_typoScriptNodeValue', $value)) {
$dottedConfiguration[$key] = $value['_typoScriptNodeValue'];
}
$dottedConfiguration[$key . '.'] = $this->makeConfigurationArrayRenderable($value);
} else {
$dottedConfiguration[$key] = $value;
}
}
return $dottedConfiguration;
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace PwTeaserTeam\PwTeaser\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
* 2016 Tim Klein-Hitpass <tim.klein-hitpass@diemedialen.de>
* Kai Ratzeburg <kai.ratzeburg@diemedialen.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* This class creates links to social bookmark services, recommending the
* current front-end page.
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class GetContentViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper
{
protected $escapeOutput = false;
/**
* @return void
*/
public function initializeArguments()
{
parent::initializeArguments();
$this->registerArgument('contents', 'array', 'Content elements');
$this->registerArgument('as', 'string', 'the name of the iteration variable', true);
$this->registerArgument('colPos', 'integer', 'column position to get content elements from', false, 0);
$this->registerArgument('cType', 'string', 'the cType to filter content elements for');
$this->registerArgument('index', 'integer', 'limits the output to n-th element');
}
public function render()
{
$contents = $this->arguments['contents'];
if ($contents === null) {
return '';
}
$output = '';
$indexCount = 0;
$breakNow = false;
$asHasBeenSet = false;
/** @var $content \PwTeaserTeam\PwTeaser\Domain\Model\Content */
foreach ($contents as $content) {
$contentCtype = $content->getCtype();
$contentColPos = $content->getColPos();
if ($contentColPos == $this->arguments['colPos']) {
if ($this->arguments['cType'] === null || $contentCtype == $this->arguments['cType']) {
if ($this->arguments['index'] === null) {
$this->templateVariableContainer->add($this->arguments['as'], $content);
$asHasBeenSet = true;
} else {
if ($indexCount == $this->arguments['index']) {
$this->templateVariableContainer->add($this->arguments['as'], $content);
$asHasBeenSet = true;
$breakNow = true;
}
}
}
}
if ($asHasBeenSet) {
$output .= $this->renderChildren();
$this->templateVariableContainer->remove($this->arguments['as']);
$asHasBeenSet = false;
}
if ($breakNow) {
break;
}
if ($this->arguments['cType'] === null || $contentCtype == $this->arguments['cType']) {
$indexCount++;
}
}
return $output;
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace PwTeaserTeam\PwTeaser\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* This view helper removes whitespaces which are annoying the HTML output,
* cause some browsers are interpreting tabs and new lines.
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class RemoveWhitespacesViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
{
/**
* Returns the content without dispensable whitespaces
*
* @return string Rendered string, may be empty.
*/
public function render()
{
return str_replace(["\t", "\r", "\n"], '', $this->renderChildren());
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace PwTeaserTeam\PwTeaser\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* This class strips html and php code out of a string
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class StripTagsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
{
/**
* Strips html and php code out of a string
*
* @param string $string The string which will be stripped
* @return string the stripped string
*/
public function render($string = null)
{
if ($string === null) {
$string = html_entity_decode($this->renderChildren());
if ($string === null) {
return '';
}
}
return strip_tags($string);
}
}

View File

@@ -0,0 +1,252 @@
<?php
namespace PwTeaserTeam\PwTeaser\ViewHelpers\Widget\Controller;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* This view helper uses the technology of paginate widget but works with arrays
* and the assigned objects don't need the QueryResultInterface.
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class PaginateController extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController
{
/**
* @var array
*/
protected $configuration = [
'itemsPerPage' => 5,
'insertAbove' => false,
'insertBelow' => true,
'maximumVisiblePages' => 7
];
/**
* @var array
*/
protected $objects;
/**
* @var integer
*/
protected $currentPage = 1;
/**
* @var integer
*/
protected $numberOfPages = 1;
/**
* @var integer
*/
protected $itemsPerPage = 0;
/**
* Initialize Action of the widget controller
*
* @return void
*/
public function initializeAction()
{
$this->objects = $this->widgetConfiguration['objects'];
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
$this->configuration,
$this->widgetConfiguration['configuration']
);
}
/**
* Returns the items per page
*
* @return integer the items per page
*/
public function getItemsPerPage()
{
return $this->itemsPerPage;
}
/**
* Sets the items per page
*
* @param integer $itemsPerPage the items per page
* @return void
*/
public function setItemsPerPage($itemsPerPage)
{
if (empty($itemsPerPage)) {
$this->itemsPerPage = (integer)$this->configuration['itemsPerPage'];
} else {
$this->itemsPerPage = $itemsPerPage;
}
}
/**
* Returns the number of pages
*
* @return integer
*/
public function getNumberOfPages()
{
return $this->numberOfPages;
}
/**
* Sets the number of pages
*
* @param integer $numberOfPages the number of pages
* @return void
*/
public function setNumberOfPages($numberOfPages)
{
$this->numberOfPages = $numberOfPages;
}
/**
* Returns the current page
*
* @return integer the current page
*/
public function getCurrentPage()
{
return $this->currentPage;
}
/**
* Sets the current page and limits it between 1 and $this->numberOfPages.
*
* @param integer $currentPage the current page
* @return void
*/
public function setCurrentPage($currentPage)
{
$this->currentPage = $currentPage;
if ($this->currentPage < 1) {
$this->currentPage = 1;
} elseif ($this->currentPage > $this->numberOfPages) {
$this->currentPage = $this->numberOfPages;
}
}
/**
* Returns all visible objects within a range, depending on itemsPerPage and the currentPage.
*
* @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult|array $objects the list of objects
* @return array<mixed> the list of visible objects
*/
public function getVisibleObjects($objects)
{
$i = 0;
$modifiedObjects = [];
$indexMin = $this->itemsPerPage * ($this->currentPage - 1);
$indexMax = $this->itemsPerPage * $this->currentPage - 1;
foreach ($objects as $object) {
if ($i >= $indexMin && $i <= $indexMax) {
$modifiedObjects[] = $object;
}
$i++;
}
return $modifiedObjects;
}
/**
* Index action of the widget controller
*
* @param integer $currentPage
* @param integer $itemsPerPage
* @return void
*/
public function indexAction($currentPage = 1, $itemsPerPage = 0)
{
$this->setItemsPerPage($itemsPerPage);
$this->setNumberOfPages(intval(ceil(count($this->objects) / (integer)$this->itemsPerPage)));
$this->setCurrentPage((integer)$currentPage);
$this->view->assign(
'contentArguments',
[
$this->widgetConfiguration['as'] => $this->getVisibleObjects($this->objects)
]
);
$this->view->assign('configuration', $this->configuration);
$this->view->assign('pagination', $this->buildPagination());
$this->view->assign('itemsPerPage', $this->itemsPerPage);
}
/**
* Returns an array with the keys "pages", "current", "numberOfPages", "nextPage" & "previousPage"
*
* @return array
*/
protected function buildPagination()
{
$sidePageCount = intval($this->configuration['maximumVisiblePages']) >> 1;
$firstPage = max($this->currentPage - $sidePageCount, 1);
$lastPage = min($firstPage + $sidePageCount * 2, $this->numberOfPages);
$firstPage = max($lastPage - $sidePageCount * 2, 1);
$pages = [];
foreach (range($firstPage, $lastPage) as $index) {
$pages[] = [
'number' => $index,
'isCurrent' => ($index === $this->currentPage)
];
}
$pagination = [
'pages' => $pages,
'current' => $this->currentPage,
'numberOfPages' => $this->numberOfPages,
'itemsPerPage' => $this->itemsPerPage,
'firstPage' => 1,
'lastPage' => $this->numberOfPages,
'isFirstPage' => ($this->currentPage == 1),
'isLastPage' => ($this->currentPage == $this->numberOfPages)
];
return $this->addPreviousAndNextPage($pagination);
}
/**
* Adds the nextPage and the previousPage to the pagination array
*
* @param array $pagination the pagination array which get previous and
* next page
* @return array the pagination array which contains some meta data and
* another array which are the pages
*/
protected function addPreviousAndNextPage($pagination)
{
if ($this->currentPage < $this->numberOfPages) {
$pagination['nextPage'] = $this->currentPage + 1;
}
if ($this->currentPage > 1) {
$pagination['previousPage'] = $this->currentPage - 1;
}
return $pagination;
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace PwTeaserTeam\PwTeaser\ViewHelpers\Widget;
/***************************************************************
* Copyright notice
*
* (c) 2011-2020 Armin Vieweg <armin@v.ieweg.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* This widget is a copy of the fluid paginate widget. Now it's possible to
* use arrays with paginate, not only query results.
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class PaginateViewHelper extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper
{
/**
* @var \PwTeaserTeam\PwTeaser\ViewHelpers\Widget\Controller\PaginateController
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $controller;
/**
* The render method of widget
*
* @param mixed $objects
* @param string $as
* @param array $configuration
* @return string
*/
public function render(
$objects,
$as,
array $configuration = ['itemsPerPage' => 10, 'insertAbove' => false, 'insertBelow' => true]
) {
return $this->initiateSubRequest();
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
// This configuration is used for TYPO3 10 and later
// Previous versions use "ext_typoscript_setup.txt" file in root of extension.
return [
PwTeaserTeam\PwTeaser\Domain\Model\Page::class => [
'tableName' => 'pages',
'properties' => [
'navTitle' => ['fieldName' => 'nav_title'],
'authorEmail' => ['fieldName' => 'author_email'],
'tstamp' => ['fieldName' => 'tstamp'],
'creationDate' => ['fieldName' => 'crdate'],
'lastUpdated' => ['fieldName' => 'lastUpdated'],
'starttime' => ['fieldName' => 'starttime'],
'endtime' => ['fieldName' => 'endtime'],
'newUntil' => ['fieldName' => 'newUntil'],
'sorting' => ['fieldName' => 'sorting'],
'l18nConfiguration' => ['fieldName' => 'l18n_cfg'],
]
],
\PwTeaserTeam\PwTeaser\Domain\Model\Content::class => [
'tableName' => 'tt_content',
'properties' => [
'pid' => ['fieldName' => 'pid'],
'colPos' => ['fieldName' => 'colPos'],
'ctype' => ['fieldName' => 'CType'],
'tstamp' => ['fieldName' => 'tstamp'],
'crdate' => ['fieldName' => 'crdate'],
]
]
];

View File

@@ -0,0 +1,514 @@
<T3DataStructure>
<sheets>
<generalsheet>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:general</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.source>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:sourceLabel</label>
<onChange>reload</onChange>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:default</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:source.thisChildren</numIndex>
<numIndex index="1">thisChildren</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:source.thisChildrenRecursively</numIndex>
<numIndex index="1">thisChildrenRecursively</numIndex>
</numIndex>
<numIndex index="3" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:source.custom</numIndex>
<numIndex index="1">custom</numIndex>
</numIndex>
<numIndex index="4" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:source.customChildren</numIndex>
<numIndex index="1">customChildren</numIndex>
</numIndex>
<numIndex index="5" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:source.customChildrenRecursively</numIndex>
<numIndex index="1">customChildrenRecursively</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</settings.source>
<settings.customPages>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:customPages</label>
<displayCond>FIELD:settings.source:IN:custom,customChildren,customChildrenRecursively</displayCond>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>10</size>
<maxitems>999</maxitems>
<minitems>0</minitems>
<show_thumbs>1</show_thumbs>
</config>
</TCEforms>
</settings.customPages>
<settings.recursionDepthFrom>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:recursionDepthFrom</label>
<displayCond>
<OR>
<numIndex index="0">FIELD:settings.source:IN:thisChildrenRecursively,customChildrenRecursively</numIndex>
<numIndex index="1">FIELD:settings.pageMode:!=:nested</numIndex>
</OR>
</displayCond>
<config>
<type>input</type>
<eval>int</eval>
<default>0</default>
<size>5</size>
</config>
</TCEforms>
</settings.recursionDepthFrom>
<settings.recursionDepth>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:recursionDepth</label>
<displayCond>FIELD:settings.source:IN:thisChildrenRecursively,customChildrenRecursively</displayCond>
<config>
<type>input</type>
<eval>int</eval>
<default>255</default>
<size>5</size>
</config>
</TCEforms>
</settings.recursionDepth>
<settings.orderByPlugin>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:orderByPlugin</label>
<displayCond>FIELD:settings.source:IN:custom</displayCond>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:default</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:yes</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:no</numIndex>
<numIndex index="1">0</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</settings.orderByPlugin>
<settings.loadContents>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:loadContents</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:default</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:yes</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:no</numIndex>
<numIndex index="1">0</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</settings.loadContents>
<settings.pageMode>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:pageMode</label>
<onChange>reload</onChange>
<displayCond>FIELD:settings.source:!IN:custom</displayCond>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:default</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:pageMode.flat</numIndex>
<numIndex index="1">flat</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:pageMode.nested</numIndex>
<numIndex index="1">nested</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</settings.pageMode>
</el>
</ROOT>
</generalsheet>
<orderingsheet>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:ordering</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.orderBy>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order</label>
<onChange>reload</onChange>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:default</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order.title</numIndex>
<numIndex index="1">title</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order.sorting</numIndex>
<numIndex index="1">sorting</numIndex>
</numIndex>
<numIndex index="3" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order.crdate</numIndex>
<numIndex index="1">crdate</numIndex>
</numIndex>
<numIndex index="4" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order.tstamp</numIndex>
<numIndex index="1">tstamp</numIndex>
</numIndex>
<numIndex index="5" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order.starttime</numIndex>
<numIndex index="1">starttime</numIndex>
</numIndex>
<numIndex index="6" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order.endtime</numIndex>
<numIndex index="1">endtime</numIndex>
</numIndex>
<numIndex index="7" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order.newtime</numIndex>
<numIndex index="1">newUntil</numIndex>
</numIndex>
<numIndex index="8" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order.random</numIndex>
<numIndex index="1">random</numIndex>
</numIndex>
<numIndex index="9" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:order.customField</numIndex>
<numIndex index="1">customField</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
</config>
</TCEforms>
</settings.orderBy>
<settings.orderByCustomField>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:orderByCustomField</label>
<displayCond>FIELD:settings.orderBy:IN:customField</displayCond>
<config>
<type>input</type>
<eval>trim</eval>
<default></default>
<size>16</size>
</config>
</TCEforms>
</settings.orderByCustomField>
<settings.orderDirection>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:orderDirection</label>
<displayCond>FIELD:settings.orderBy:IN:title,sorting,crdate,tstamp,starttime,endtime,customField</displayCond>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:default</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:orderDirection.asc</numIndex>
<numIndex index="1">asc</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:orderDirection.desc</numIndex>
<numIndex index="1">desc</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</settings.orderDirection>
<settings.limit>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:limit</label>
<config>
<type>input</type>
<eval>trim,num</eval>
<default></default>
<size>2</size>
</config>
</TCEforms>
</settings.limit>
<settings.showNavHiddenItems>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:showNavHiddenItems</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:default</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:yes</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:no</numIndex>
<numIndex index="1">0</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</settings.showNavHiddenItems>
<settings.hideCurrentPage>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:hideCurrentPage</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:default</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:yes</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:no</numIndex>
<numIndex index="1">0</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</settings.hideCurrentPage>
<settings.showDoktypes>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:showDoktypes</label>
<config>
<type>input</type>
<eval>trim</eval>
<size>8</size>
<default>1,2</default>
</config>
</TCEforms>
</settings.showDoktypes>
<settings.ignoreUids>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:ignoreUids</label>
<config>
<type>input</type>
<eval>trim</eval>
<size>16</size>
</config>
</TCEforms>
</settings.ignoreUids>
<settings.categoriesList>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:categories</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<autoSizeMax>10</autoSizeMax>
<foreign_table>sys_category</foreign_table>
<foreign_table_where> AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.sorting ASC</foreign_table_where>
<maxitems>999</maxitems>
<renderMode>tree</renderMode>
<size>5</size>
<treeConfig>
<appearance>
<expandAll>1</expandAll>
<showHeader>1</showHeader>
</appearance>
<parentField>parent</parentField>
</treeConfig>
</config>
</TCEforms>
</settings.categoriesList>
<settings.categoryMode>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:categoryMode</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:default</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:categoryMode.or</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:categoryMode.and</numIndex>
<numIndex index="1">2</numIndex>
</numIndex>
<numIndex index="3" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:categoryMode.orNot</numIndex>
<numIndex index="1">3</numIndex>
</numIndex>
<numIndex index="4" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:categoryMode.andNot</numIndex>
<numIndex index="1">4</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
<default></default>
</config>
</TCEforms>
</settings.categoryMode>
</el>
</ROOT>
</orderingsheet>
<tempaltesheet>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:template</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<view.templateType>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:templateType</label>
<onChange>reload</onChange>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:templateType.preset</numIndex>
<numIndex index="1">preset</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:templateType.file</numIndex>
<numIndex index="1">file</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:templateType.directory</numIndex>
<numIndex index="1">directory</numIndex>
</numIndex>
</items>
<default>preset</default>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</view.templateType>
<view.templatePreset>
<TCEforms>
<displayCond>FIELD:view.templateType:IN:preset,</displayCond>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:templatePreset</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<itemsProcFunc>PwTeaserTeam\PwTeaser\UserFunction\ItemsProcFunc->getAvailableTemplatePresets</itemsProcFunc>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0"></numIndex>
<numIndex index="1"></numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</view.templatePreset>
<view.templateRootFile>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:templateRootFile</label>
<displayCond>FIELD:view.templateType:IN:file,</displayCond>
<config>
<type>input</type>
<eval>trim</eval>
<default></default>
</config>
</TCEforms>
</view.templateRootFile>
<view.templateRootPath>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:templateRootPath</label>
<displayCond>FIELD:view.templateType:IN:directory</displayCond>
<config>
<type>input</type>
<eval>trim</eval>
<default></default>
</config>
</TCEforms>
</view.templateRootPath>
<view.partialRootPath>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:partialRootPath</label>
<displayCond>FIELD:view.templateType:IN:file,directory</displayCond>
<config>
<type>input</type>
<eval>trim</eval>
<default></default>
</config>
</TCEforms>
</view.partialRootPath>
<view.layoutRootPath>
<TCEforms>
<label>LLL:EXT:pw_teaser/Resources/Private/Language/locallang_flexform.xml:layoutRootPath</label>
<displayCond>FIELD:view.templateType:IN:file,directory</displayCond>
<config>
<type>input</type>
<eval>trim</eval>
<default></default>
</config>
</TCEforms>
</view.layoutRootPath>
</el>
</ROOT>
</tempaltesheet>
</sheets>
</T3DataStructure>

View File

@@ -0,0 +1,7 @@
<?php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'pw_teaser',
'Configuration/TypoScript',
'PwTeaser'
);

View File

@@ -0,0 +1,17 @@
<?php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'PwTeaserTeam.' . 'pw_teaser',
'Pi1',
'Page Teaser (pw_teaser)'
);
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase('pw_teaser');
$pluginSignature = strtolower($extensionName) . '_pi1';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'select_key,pages,recursive';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature,
'FILE:EXT:' . 'pw_teaser' . '/Configuration/FlexForms/flexform_teaser.xml'
);

View File

@@ -0,0 +1,35 @@
plugin.tx_pwteaser {
view.presets {
default {
label = Default
templateRootFile = EXT:pw_teaser/Resources/Private/Templates/Teaser/Index.html
partialRootPaths.10 = EXT:pw_teaser/Resources/Private/Partials
layoutRootPaths.10 = EXT:pw_teaser/Resources/Private/Layouts
}
headlineAndImage {
label = Headline & Images
templateRootFile = EXT:pw_teaser/Resources/Private/Templates/HeadlineAndImage.html
partialRootPaths.10 = EXT:pw_teaser/Resources/Private/Partials
layoutRootPaths.10 = EXT:pw_teaser/Resources/Private/Layouts
}
headlineOnly {
label = Headline only
templateRootFile = EXT:pw_teaser/Resources/Private/Templates/HeadlinesOnly.html
partialRootPaths.10 = EXT:pw_teaser/Resources/Private/Partials
layoutRootPaths.10 = EXT:pw_teaser/Resources/Private/Layouts
}
}
}
lib.tx_pwteaser = USER
lib.tx_pwteaser {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = PwTeaserTeam
extensionName = PwTeaser
pluginName = Pi1
settings =< plugin.tx_pwteaser.settings
persistence =< plugin.tx_pwteaser.persistence
view =< plugin.tx_pwteaser.view
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -0,0 +1,474 @@
.. include:: ../Includes.txt
.. _configuration:
Configuration
=============
pw_teaser provides plugin settings, which can get preset by TypoScript. Settings set in plugin directly (FlexForm) will
overwrite the TypoScript defaults.
.. _configuration_reference:
Reference
---------
- :ref:`configuration-general`
- :ref:`configuration-visibility`
- :ref:`configuration-template`
.. _configuration-general:
General preferences
~~~~~~~~~~~~~~~~~~~
.. image:: Images/settings-general.png
:alt: General settings in pw_teaser plugin
:width: 50%
===================================== ============
Property Type
===================================== ============
source_ ``string``
customPages_ ``string``
recursionDepthFrom_ ``integer``
recursionDepth_ ``integer``
orderByPlugin_ ``bool``
loadContents_ ``bool``
pageMode_ ``string``
===================================== ============
.. _source:
source
""""""
.. container:: table-row
Property
source
Data type
string
Description
Defines which pages should be listed. Allowed values: ``thisChildren``, ``thisChildrenRecursively``, ``custom``,
``customChildren`` or ``customChildrenRecursively``.
.. _customPages:
customPages
"""""""""""
.. container:: table-row
Property
customPages
Data type
string
Description
Comma separated list of page uids, which should get listed. In plugin this field is just visible if source got
one of the values ``custom``, ``customChildren`` or ``customChildrenRecursively``.
.. _recursionDepthFrom:
recursionDepthFrom
""""""""""""""""""
.. container:: table-row
Property
recursionDepthFrom
Data type
integer
Default
0
Description
Start of recursion depth. Default is zero (0).
Just takes effect if source is ``thisChildrenRecursively`` or ``customChildrenRecursively``.
.. _recursionDepth:
recursionDepth
""""""""""""""
.. container:: table-row
Property
recursionDepth
Data type
integer
Default
0
Description
Depth of recursion. Just takes effect if source is ``thisChildrenRecursively`` or ``customChildrenRecursively``.
.. _orderByPlugin:
orderByPlugin
""""""""""""""
.. container:: table-row
Property
orderByPlugin
Data type
boolean
Default
0
Description
Just visible if source got the value ``custom``.
If enabled the pages will be ordered like defined in field customPages.
.. _loadContents:
loadContents
""""""""""""
.. container:: table-row
Property
loadContents
Data type
boolean
Default
0
Description
If checked the contents (tt_content) of current page will be loaded too.
This may need more performance, and should only be enabled if used.
.. _pageMode:
pageMode
""""""""
.. container:: table-row
Property
pageMode
Data type
string
Default
flat
Description
Defines how found pages should be passed to fluid template. Possible values are: ``flat`` and ``nested``.
Default is ``flat``. If ``nested`` is chosen, subpages get filled in the attribute "childPages" recursively
instead of passing a flat array.
In this case the options ``recursionDepthFrom``, ``orderBy`` and ``limit`` will be ignored.
The option ``nested`` is not available for source custom.
.. _configuration-visibility:
Visibility options
~~~~~~~~~~~~~~~~~~
.. image:: Images/settings-visibility.png
:alt: Visibility settings in pw_teaser plugin
:width: 50%
===================================== ============
Property Type
===================================== ============
orderBy_ ``string``
orderByCustomField_ ``string``
orderDirection_ ``string``
limit_ ``integer``
showNavHiddenItems_ ``bool``
hideCurrentPage_ ``bool``
showDoktypes_ ``string``
ignoreUids_ ``string``
categoriesList_ ``string``
categoryMode_ ``integer``
===================================== ============
.. _orderBy:
orderBy
"""""""
.. container:: table-row
Property
orderBy
Data type
string
Description
Results may get ordered by: ``title``, ``sorting``, ``crdate``, ``tstamp``, ``starttime``, ``endtime``,
``newUntil``, ``random`` or ``customField``.
.. _orderByCustomField:
orderByCustomField
""""""""""""""""""
.. container:: table-row
Property
orderByCustomField
Data type
string
Description
If orderBy got value ``customField``, this field defines the name of the custom field to order by.
This is useful if you have extended the ``pages`` table with new columns.
.. _orderDirection:
orderDirection
""""""""""""""
.. container:: table-row
Property
orderDirection
Data type
string
Default
asc
Description
Controls the direction of ordering. May be: ``asc`` or ``desc``. Has no effect when orderBy is ``random``.
.. _limit:
limit
"""""
.. container:: table-row
Property
limit
Data type
integer
Default
0
Description
Amount of pages which should be displayed. First the ordering takes effect, then it will be limited.
When zero (0), limitation is disabled.
.. _showNavHiddenItems:
showNavHiddenItems
""""""""""""""""""
.. container:: table-row
Property
showNavHiddenItems
Data type
boolean
Default
0
Description
If enabled pages which are hidden for navigation (``nav_hide``), will be displayed anyway.
.. _hideCurrentPage:
hideCurrentPage
"""""""""""""""
.. container:: table-row
Property
hideCurrentPage
Data type
boolean
Default
1
Description
If enabled the current page will be removed from result.
This has no effect, if the current page is no part of results anyway.
.. _showDoktypes:
showDoktypes
""""""""""""
.. container:: table-row
Property
showDoktypes
Data type
string
Default
1,2
Description
Comma separated list of ``doktype`` to display.
.. _ignoreUids:
ignoreUids
""""""""""
.. container:: table-row
Property
ignoreUids
Data type
string
Description
Comma separated list of page uids which should be ignored, always.
.. _categoriesList:
categoriesList
""""""""""""""
.. container:: table-row
Property
categoriesList
Data type
string
Description
Comma separated list of ``sys_category`` uids, which are selected.
.. _categoryMode:
categoryMode
""""""""""""
.. container:: table-row
Property
categoryMode
Data type
integer
Description
Mode to influence showed pages by selected categories (categoriesList). Available modes are:
* ``1`` - Show pages with selected categories (OR)
* ``2`` - Show pages with selected categories (AND)
* ``3`` - Do NOT show pages witch selected categories (OR)
* ``4`` - Do NOT show pages witch selected categories (AND)
.. _configuration-template:
Template view
~~~~~~~~~~~~~
See :ref:`templates` for further details.
.. image:: Images/settings-template.png
:alt: Template settings in pw_teaser plugin
:width: 50%
===================================== ============
Property Type
===================================== ============
templateType_ ``string``
templatePreset_ ``string``
templateRootFile_ ``string``
templateRootPath_ ``string``
partialRootPath_ ``string``
layoutRootPath_ ``string``
===================================== ============
.. _templateType:
templateType
""""""""""""
.. container:: table-row
Property
templateType
Data type
string
Default
preset
Description
Defines the type of templating. The following types are supported:
* ``preset`` (default)
* ``file``
* ``directory``
.. _templatePreset:
templatePreset
""""""""""""""
.. container:: table-row
Property
templatePreset
Data type
string
Description
Only available when templateType is set to ``preset``.
Name of preset to use. The given preset name must be configured in TypoScript setup.
.. _templateRootFile:
templateRootFile
""""""""""""""""
.. container:: table-row
Property
templateRootFile
Data type
string
Description
Only available when templateType is set to ``file``.
Full path (relative to TYPO3 root) to Fluid template file (incl. filename).
.. _templateRootPath:
templateRootPath
""""""""""""""""
.. container:: table-row
Property
templateRootPath
Data type
string
Description
Only available when templateType is set to ``directory``.
Path to Fluid template directory, which contains the folder "Teaser", which contains the "Index.html" file.
In this template mode, the directory contents must match Controller/Actions of pw_teaser.
.. _partialRootPath:
partialRootPath
"""""""""""""""
.. container:: table-row
Property
partialRootPath
Data type
string
Description
Set an additional root path for partials, added after pw_teaser partial root path.
In TypoScript you can also use ``partialRootPaths`` and define several partial paths. This setting is only used,
when ``partialRootPaths`` (from TypoScript) is empty.
.. _layoutRootPath:
layoutRootPath
""""""""""""""
.. container:: table-row
Property
layoutRootPath
Data type
string
Description
See ``partialRootPath`` for details. Same rules apply for this option.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,61 @@
.. include:: ../Includes.txt
.. _firstSteps:
First steps
===========
Create the first teaser
-----------------------
Go to any page you want to add a teaser list of pages, and **add a new page teaser plugin**:
.. image:: Images/add-plugin.png
:alt: pw_teaser in new content element wizard in TYPO3 backend
On tab "Plugin" you see all settings pw_teaser has:
.. image:: Images/plugin-sheet-general.png
:alt: General preferences of pw_teaser plugin
Define data source
------------------
First, we define which pages we want to display. We can choose between those **teaser sources**:
- Childpages of current page
- Childpages of current page (recursively)
- Selected pages
- Childpages of selected pages
- Childpages of selected pages (recursively)
When you change the source to "selected pages", a new field **Custom pages** appears after reloading:
.. image:: Images/custom-pages.png
:alt: Define custom pages when pw_teaser source is "selected pages"
Here you select page(s) from the page tree which should be used as the source for your teaser list.
Make further options
--------------------
In visibility options, you can filter or change the ordering of pages in the result.
Under tab "Template" you can choose from some template presets.
See the teaser in frontend
--------------------------
**That's it!** Congratulations, you've configured your first page teaser!
In frontend you get a list with pages:
.. image:: Images/default-frontend-output.png
:alt: Default frontend output of pw_teaser
:width: 50%
:class: with-border
Checkout :ref:`templates` for info about how to provide your own templates.

View File

@@ -0,0 +1,17 @@
.. This is 'Includes.txt'. It is included at the very top of each and
every ReST source file in THIS documentation project (= manual).
.. role:: aspect (emphasis)
.. role:: html(code)
.. role:: js(code)
.. role:: php(code)
.. role:: sep (strong)
.. role:: sql(code)
.. role:: typoscript(code)
.. role:: yaml(code)
.. role:: ts(typoscript)
:class: typoscript
.. default-role:: code
.. highlight:: php

View File

@@ -0,0 +1,60 @@
.. include:: Includes.txt
.. _start:
=============================================================
Page Teaser (with Fluid)
=============================================================
.. only:: html
:Classification:
pw_teaser
:Version:
|release|
:Language:
en
:Description:
Create powerful, dynamic page teasers with data from page properties and its content elements. Based on Extbase and Fluid Template Engine.
:Keywords:
TYPO3 CMS, teaser, pages, sitemap
:Copyright:
2010-2020
:Author:
Armin Vieweg
:Email:
armin@v.ieweg.de
:License:
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
:Rendered:
|today|
The content of this document is related to TYPO3,
a GNU/GPL CMS/Framework available from `www.typo3.org <http://www.typo3.org/>`_.
**Table of Contents**
.. toctree::
:maxdepth: 2
:titlesonly:
Installation/Index
FirstSteps/Index
Configuration/Index
UsingTypoScript/Index
Templates/Index
SignalSlot/Index
Versions/Index
Support/Index

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -0,0 +1,33 @@
.. include:: ../Includes.txt
.. _installation:
Installation
============
Download
--------
You can use the TER (TYPO3 Extension Repository) or Composer to fetch ``t3/pw_teaser`` package.
- TER: https://extensions.typo3.org/extension/pw_teaser
- Packagist: https://packagist.org/packages/t3/pw_teaser
Don't forget to enable the extension in Extension Manager!
TypoScript Setup
----------------
When pw_teaser is successfully installed, you need to **include the provided TypoScript** to your TypoScript template:
.. image:: Images/include-static-typoscript.png
:alt: Include static TypoScript of pw_teaser
.. important::
When you don't include the pw_teaser TypoScript, plugin settings like "Template preset" remain empty.
That's it. Now, pw_teaser is ready to get used.

View File

@@ -0,0 +1,4 @@
[general]
project = Page Teaser (with Fluid)
release = latest

View File

@@ -0,0 +1,35 @@
# This is the project specific Settings.yml file.
# Place Sphinx specific build information here.
# Settings given here will replace the settings of 'conf.py'.
---
conf.py:
copyright: 2010-2020
project: Page Teaser (with Fluid)
version: 5.0
release: 5.0.1
latex_documents:
- - Index
- pw_teaser.tex
- 'Page Teaser (with Fluid)'
- Armin Vieweg
- manual
latex_elements:
papersize: a4paper
pointsize: 10pt
preamble: \usepackage{typo3}
intersphinx_mapping:
t3api:
- http://docs.typo3.org/typo3cms/CoreApiReference/
- null
t3tsref:
- http://docs.typo3.org/typo3cms/TyposcriptReference/
- null
t3start:
- http://docs.typo3.org/typo3cms/GettingStartedTutorial/
- null
t3editors:
- http://docs.typo3.org/typo3cms/EditorsTutorial/
- null
...

View File

@@ -0,0 +1,44 @@
.. include:: ../Includes.txt
.. _signal-slot:
Signal/Slot
===========
pw_teaser provides a signal, that may be used by your extensions **to modify the pages array** (or containing pages)
right **before assigning to view**.
To connect your slot to the signal just put this to your ``ext_localconf.php``:
::
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
$signalSlotDispatcher->connect(
\PwTeaserTeam\PwTeaser\Controller\TeaserController::class,
'indexActionModifyPages',
\Vendor\ExtensionName\Signals\PwTeaserSignal::class,
'modifyPages'
);
The class you have referenced should look like this:
::
<?php
namespace Vendor\ExtensionName\Signals;
class PwTeaserSignal
{
/**
* @param array<\PwTeaserTeam\PwTeaser\Domain\Model\Page> $pages Referenced array of pages
* @param \PwTeaserTeam\PwTeaser\Controller\TeaserController $teaserController
* @return void
*/
public function modifyPages(array &$pages, PwTeaserTeam\PwTeaser\Controller\TeaserController $teaserController) {
// Do whatever you want with referenced array in $pages
}
}
Because of the referenced array, all changes you do in the array will also take effect in pw_teaser extension.
You don't need to return anything.

View File

@@ -0,0 +1,28 @@
.. include:: ../Includes.txt
.. _support:
Support
=======
Issue tracker
-------------
See all open tasks `here`_ in the forge bug tracker.
.. _here: https://forge.typo3.org/projects/extension-pw_teaser/issues
Donate
------
If you like the pw_teaser extension, feel free to `donate`_ some funds to support further development.
.. _donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2DCCULSKFRZFU
Contribute
----------
If you are a developer and you want to submit improvements as code, you can fork https://bitbucket.org/ArminVieweg/pw_teaser/src
and make a pull request to pw_teaser's master branch.
Thanks!

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,189 @@
.. include:: ../Includes.txt
.. _templates:
Templates
=========
.. contents:: :local:
.. _template-types:
Template types
--------------
pw_teaser uses Fluid templates and offers three templateTypes to choose from.
Type: Preset
~~~~~~~~~~~~
The preset template mode is new (since 5.0) and offers the possibility to **define presets in TypoScript**.
Also, it provides a select box in plugin settings to **choose a preset**.
pw_teaser provide three presets by default:
- ``default``
- ``headlineAndImage``
- ``headlineOnly``
**This is how you register a new preset in TypoScript:**
::
plugin.tx_pwteaser {
view {
presets {
headlineAndImage {
label = Headline & Images
templateRootFile = EXT:pw_teaser/Resources/Private/Templates/HeadlineAndImage.html
partialRootPaths.10 = EXT:pw_teaser/Resources/Private/Partials
layoutRootPaths.10 = EXT:pw_teaser/Resources/Private/Layouts
}
}
}
}
.. tip::
The label supports ``LLL:`` references.
.. note::
Changes in TypoScript require to clear the system caches of TYPO3.
In plugin settings, the dropdown let the editor choose, which preset to use in frontend:
.. image:: Images/preset-dropdown.png
:alt: Preset selection in pw_teaser plugin settings
Type: File
~~~~~~~~~~
When ``view.templateType`` is set to ``file``, you also need to provide a ``view.templateRootFile`` (Fluid template file).
Type: Directory
~~~~~~~~~~~~~~~
When ``view.templateType`` is set to ``directory``, you also need to provide a ``view.templateRootPath`` (directory).
In this directory you need to provide the controller/action structure of pw_teaser:
.. image:: Images/directory-structure.png
:alt: Required directory structure of pw_teaser, when using templateType 'directory'.
.. _writing-templates:
Writing templates
-----------------
The only variable the Fluid template file get is ``{pages}``.
The most simple way to output the prepared (flat) list of pages is this:
::
<ul>
<f:for each="{pages}" as="page">
<li>
<f:link.page pageUid="{page.uid}" title="{page.title}">{page.title}</f:link.page>
</li>
</f:for>
</ul>
The provided ``Page`` model got the following properties available:
- ``title``
- ``subtitle``
- ``abstract``
- ``navTitle``
- ``alias``
- ``description``
- ``author``
- ``authorEmail``
- ``keywords`` as array with each keyword as string
- ``keywordsAsString``
- ``media``
- ``newUntil``
- ``isNew``
- ``creationDate``
- ``tstamp``
- ``lastUpdated``
- ``starttime``
- ``endtime``
- ``doktype``
- ``sorting``
- ``l18nConfiguration``
- ``categories``
- ``isCurrentPage``
- ``rootLine`` Returns rootLine of this page as array
- ``rootLineDepth`` Returns amount of parent pages, including this page itself. The root page (not id=0) got depth 1.
- ``recursiveRootLineOrdering`` Returns string of sortings of all root pages including this page.
- ``pageRow``
- ``contents`` (only available, when ``loadContents`` set to ``1``)
- ``childPages`` (only available, when ``pageMode`` set to ``nested``)
- ``get``
You can access any property the ``pages`` table got, using the ``get`` keyword. Example:
::
{page.get.tx_myext_whatever}
.. note::
In the past, the ``get`` keyword wasn't necessary, because Fluid allowed to utilize ``__call()`` method of PHP,
which is no longer the case.
getContent ViewHelper
~~~~~~~~~~~~~~~~~~~~~
The pw_teaser extension provides a view helper called ``pw:getContent``.
This view helper allows you to access special content elements from the current page in the loop.
The page has the attribute "contents". You may access it like this:
::
{page.contents}
But it contains just an array (query result) with all content elements located under the given page.
It does not respect the column or the CType. This is where getContent comes into play.
**Full example:**
::
{namespace pw=PwTeaserTeam\PwTeaser\ViewHelpers}
<f:for each="{pages}" as="page">
<div class="page">
<h3>{page.title}</h3>
<pw:getContent contents="{page.contents}" as="content" colPos="0" cType="textpic" index="0">
<f:for each="{content.image}" as="image" iteration="iterator">
<f:if condition="{iterator.isFirst} == 1">
<f:image src="{image.uid}" treatIdAsReference="1" width="400c" height="100c" />
</f:if>
</f:for>
</pw:getContent>
</div>
</f:for>
**pw:getContent arguments explained:**
- ``contents="{page.contents}"`` - Here you pass all content elements to the view helper
- ``as="content"`` - Here you define how to call the single content item inside of the view helper
- ``colPos="0"`` - Limit the content elements to given colPos (0 is default)
- ``cType="textpic"`` - Limit the content elements to given CType (eg. image, text or textpic)
- ``index="0"`` - Limit the output to n-th elements. Zero means the first element. Keep it empty for all matching elements.
When accessing images from content elements (or pages either) you can use a ``<f:for>`` loop and its option "iteration"
to limit output to one image. Therefore the example above has another <f:for>-loop inside of the getContent view helper.
.. important::
This just works if you enable the option in Page Teaser Plugin, to load content elements.

View File

@@ -0,0 +1,87 @@
.. include:: ../Includes.txt
.. _using-typoscript:
Using TypoScript
================
.. contents:: :local:
Predefine settings with TS
--------------------------
You may predefine some settings which are used in pw_teaser, unless it **will be overwritten by plugin settings**.
To do this, just write this in TypoScript setup:
::
plugin.tx_pwteaser.settings.[setting] = value
plugin.tx_pwteaser.view.[setting] = value
.. hint::
See the configuration :ref:`configuration_reference`, which settings are available.
Add a whole page teaser with TS
-------------------------------
If you want to add a page teaser in areas on your page, which are not editable by users, you can simply use typoscript
to assign it to a marker or variable (i.e.) of your template. You could put it in a COA too, of course.
**Example:**
::
10 = COA
10 {
10 = TEXT
10.value = Latest News (based on pages)
20 < lib.tx_pwteaser
20 {
settings {
# see configuration reference
}
view {
# see configuration reference
}
}
}
.. important::
The ``lib.tx_pwteaser`` is only available when you have **included the static template** to your TYPO3 template.
Using parsed TypoScript
-----------------------
You may use typoscript for aby pw_teaser setting.
**For example:**
::
plugin.tx_pwteaser.settings {
source = customPages
customPages = CONTENT
customPages {
table = pages
select {
pidInList = 1
recursive = 50
where = whatever=1337
}
renderObj = COA
renderObj.10 = TEXT
renderObj.10.field = uid
renderObj.10.wrap = | ,|*| ,| |*|
}
}
This example creates a comma-separated list for the setting "customPages". Unlikely to default Extbase behavior, the
defined settings are parsed by TypoScript parser, before used in Extbase controller.

View File

@@ -0,0 +1,115 @@
.. include:: ../Includes.txt
.. _versions:
Versions
========
.. contents:: :local:
5.0.1
-----
- [BUGFIX] Fix wrong extension icon path
- [DEVOPS] Update DDEV install scripts (for TYPO3 environments)
- [BUGFIX] Do not show warning in ItemsProcFunc, if pw_teaser typoscript is missing
- [BUGFIX] Fix wrong Extbase mapping (for TYPO3 10+)
- [TASK] Update README
5.0.0
-----
- [FEATURE] Documentation
- [BUGFIX] Remove default value for setting "hideCurrentPage" in teaser flexform
- [TASK] Set templateType by default to "preset"
- [TASK] Remove "ENABLECACHE" extension setting
- [BUGFIX] Fix image viewhelper usage in Fluid template
- [FEATURE] Template presets
- [BUGFIX] Merge view settings from plugin with typoscript
- [TASK] Set label for default value in dropdowns
- [BUGFIX] Streamline "templateRootPaths" setting
- [TASK] Update copyrights
- [TASK] Code style fixing
- [BUGFIX] Custom fluid templates not working because of missing templateRootPath
- [TASK] Move ext_tables.php contents to TCA/Overrides
- [FEATURE] Add TYPO3 10 compatibility
- Dropped support for TYPO3 8.7
4.0.0
-----
- [BUGFIX] No not escape output of GetContent ViewHelper
- [CHANGE][!!!] Introduce {page.get}
- [TASK] Compatibility Fixes
- [TASK] Set version to 4.0.0-dev and update package name to "t3/pw_teaser"
- Dropped support for TYPO3 6.2 and 7.6
3.4.2
-----
- [TASK] Fix license attribute in composer.json
- [BUGFIX] Fix missing index attributes in numIndex nodes
3.4.1
-----
- [BUGFIX] Check for version 7.5 to use IconRegistry, fallback for TYPO3 6.2
3.4.0
-----
- Add support for TYPO3 7.6 to 8.x. Also added content element wizard entry.
3.3.0
-----
Add new option "pageMode". Normally pages are passed as flat array to fluid template.
If this option is set to "nested" you get a nested page object with (new attribute) childPages.
3.2.0
-----
- Add new option "recursionDepthFrom" to define a start for recursion.
3.1.0
-----
Page and content model in pw_teaser does not have properties for all available columns in the accordant tables.
With this patch, everytime you try to access such attribute the whole row of the page/content will be loaded (and cached)
and the values will be accessible.
Example in fluid template:
::
<f:for each="{pages}" as="page">
Page Layout: {page.layout}
</f:for>
Layout is one of these attributes, existing in pages table but not in page model.
So this example will not work with previous versions of pw_teaser.
Furthermore now also attributes added by other extensions are accessible.
3.0.0
-----
- Complete TYPO3 6.2 support
- Massive refactoring of all classes (eg. namespaces)
- Add language support (behavior of teasers like menu items in TYPO3)
- Add categories attribute to Page and Content model
- $page->getMedia() and $content->getImage() works with FAL (To work in template use $page->getMediaFiles() or $content->getImageFiles())
- Add option to plugin to filter pages by categories
- Add option to plugin to define recursion depth
- Add getRootLine() and getRootLineDepth() to Page model
- New extension/plugin icon
- New Signal/Slot to modify found pages
- Many bugfixes

View File

@@ -0,0 +1,34 @@
pw_teaser for TYPO3 CMS
=======================
Features
--------
* Create nested or flat views of your page structures
* extreme detailed options to filter pages available
* layout the teasers of your pages like you want with Fluid Templates
* template presets
* pagination is also supported
* extendable with signals to modify or extend page models
Documentation
-------------
This extension provides a ReST documentation, located in Documentation/ directory.
You can see a rendered version on https://docs.typo3.org/p/t3/pw_teaser
Requirements
------------
Version 5.0 of pw_teaser requires TYPO3 9.5 or 10.4.
Links
-----
* **Donate:** https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9LJYFQGJ7S232
* Issue Tracker: https://forge.typo3.org/projects/extension-pw_teaser/issues
* Source code: https://bitbucket.org/ArminVieweg/pw_teaser

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<type>module</type>
<description>Language labels for the Extbase Teaser extension in the FRONTEND</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="newContentElementWizardTitle">Page teaser</label>
<label index="newContentElementWizardDescription">Create powerful, dynamic page teasers with pw_teaser and fluid templates.</label>
<label index="pagination_first">&#171;</label>
<label index="pagination_previous">&lt;</label>
<label index="pagination_next">&gt;</label>
<label index="pagination_last">&#187;</label>
</languageKey>
<languageKey index="de" type="array">
<label index="newContentElementWizardTitle">Seiten-Teaser</label>
<label index="newContentElementWizardDescription">Erstelle mächtige und dynamische Seiten-Teaser mit pw_teaser und Fluid-Templates.</label>
</languageKey>
</data>
</T3locallang>

View File

@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<type>module</type>
<description>Language labels for the pw_teaser extension in the Flexform formular</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="general">General preferences</label>
<label index="ordering">Visibility options</label>
<label index="enableFields">EnableFields</label>
<label index="template">Template</label>
<label index="default">[Defined by TypoScript]</label>
<label index="yes">Yes</label>
<label index="no">No</label>
<label index="sourceLabel">Teaser source:</label>
<label index="source.thisChildren">Childpages of current page</label>
<label index="source.thisChildrenRecursively">Childpages of current page (recursively)</label>
<label index="source.custom">Selected pages</label>
<label index="source.customChildren">Childpages of selected pages</label>
<label index="source.customChildrenRecursively">Childpages of selected pages (recursively)</label>
<label index="customPages">Custom Pages:</label>
<label index="recursionDepthFrom">Recursion depth (from):</label>
<label index="recursionDepth">Recursion depth (to):</label>
<label index="loadContents">Load content elements of each page for use in template (requires more performance):</label>
<label index="orderByPlugin">Order selected pages as in the list above (this will overwrite the order settings in visibility options tab)</label>
<label index="pageMode">Page mode:</label>
<label index="pageMode.flat">Flat</label>
<label index="pageMode.nested">Nested</label>
<label index="order">Order by:</label>
<label index="order.crdate">Creation Date</label>
<label index="order.tstamp">Modification Date</label>
<label index="order.starttime">Publish Date</label>
<label index="order.endtime">Expiration Date</label>
<label index="order.newtime">Marked as new Date</label>
<label index="order.sorting">Sorting in pagetree</label>
<label index="order.title">Title (alphabetical)</label>
<label index="order.random">Random</label>
<label index="order.customField">Custom field</label>
<label index="orderByCustomField">Custom field to order by (throws exception, if field doesn't exists):</label>
<label index="orderDirection">Order direction:</label>
<label index="orderDirection.asc">Ascending (A-Z, oldest and fewest first)</label>
<label index="orderDirection.desc">Descending (Z-A, newest and most first)</label>
<label index="limit">Limit (max. number of pages to show):</label>
<label index="showNavHiddenItems">Show pages which are hidden for navigation:</label>
<label index="hideCurrentPage">Hide current page from list:</label>
<label index="showDoktypes">Show pages with doktypes (comma separated, leave empty to show all):</label>
<label index="ignoreUids">Ignore the following pages by uid (comma separated):</label>
<label index="categories">Filter by categories:</label>
<label index="categoryMode">Category mode:</label>
<label index="categoryMode.or">Show pages with selected categories (OR)</label>
<label index="categoryMode.and">Show pages with selected categories (AND)</label>
<label index="categoryMode.orNot">Do NOT show pages witch selected categories (OR)</label>
<label index="categoryMode.andNot">Do NOT show pages witch selected categories (AND)</label>
<label index="templateType">Template type:</label>
<label index="templateType.file">HTML file</label>
<label index="templateType.directory">Fluid template directory</label>
<label index="templateType.preset">Preset</label>
<label index="templatePreset">Template preset</label>
<label index="templateRootFile">Template file (with fullpath, example: fileadmin/templates/pw_teaser/Example.html):</label>
<label index="templateRootPath">Template directory (with fullpath, example: fileadmin/templates/pw_teaser/):</label>
<label index="partialRootPath">Partial directory (with fullpath, example: fileadmin/templates/pw_teaser/Partials/):</label>
<label index="layoutRootPath">Layouts directory (with fullpath, example: fileadmin/templates/pw_teaser/Layouts/):</label>
</languageKey>
<languageKey index="de" type="array">
<label index="general">Allgemein Einstellungen</label>
<label index="ordering">Anzeige Einstellungen</label>
<label index="enableFields">Aktivierungsfelder</label>
<label index="template">Template</label>
<label index="default">[Durch TypoScript definiert]</label>
<label index="yes">Ja</label>
<label index="no">Nein</label>
<label index="sourceLabel">Teaser-Quelle:</label>
<label index="source.thisChildren">Unterseiten der aktuellen Seite</label>
<label index="source.thisChildrenRecursively">Unterseiten der aktuellen Seite (rekursiv)</label>
<label index="source.custom">Ausgewählte Seiten</label>
<label index="source.customChildren">Unterseiten von ausgewählten Seiten</label>
<label index="source.customChildrenRecursively">Unterseiten von ausgewählten Seiten (rekursiv)</label>
<label index="customPages">Bestimmte Seiten:</label>
<label index="recursionDepthFrom">Rekursionstiefe (von):</label>
<label index="recursionDepth">Rekursionstiefe (bis):</label>
<label index="loadContents">Lade Inhalte (Content-Elemente) von jeder Seite um im Template verwendet werden zu können (benötigt mehr Performance):</label>
<label index="orderByPlugin">Sortiere die ausgewählten Seiten wie in der Liste oben (Sortierungs-Einstellungen im Anzeige-Einstellungen-Tab werden überschrieben):</label>
<label index="pageMode">Seiten-Modus:</label>
<label index="pageMode.flat">Flach</label>
<label index="pageMode.nested">Verschachtelt</label>
<label index="order">Sortieren nach:</label>
<label index="order.crdate">Erstellungsdatum</label>
<label index="order.tstamp">Änderungsdatum</label>
<label index="order.starttime">Veröffentlichungsdatum (von)</label>
<label index="order.endtime">Ablaufdatum (bis)</label>
<label index="order.newtime">"Markiert als neu" Datum</label>
<label index="order.sorting">Sortierung im Seitenbaum</label>
<label index="order.title">Titel (alphabetisch)</label>
<label index="order.random">Zufällige Sortierung</label>
<label index="order.customField">Benutzerdefiniertes Feld</label>
<label index="orderByCustomField">Benutzerdefiniertes Feld, nach dem sortiert werden soll (wirft einen Fehler, wenn das Feld nicht existiert):</label>
<label index="orderDirection">Sortierrichtung:</label>
<label index="orderDirection.asc">Aufsteigend (A-Z, Älteste und Wenigste als Erstes)</label>
<label index="orderDirection.desc">Absteigend (Z-A, Neuste und Meiste als Erstes)</label>
<label index="limit">Limit (max. Seitenanzahl)</label>
<label index="showNavHiddenItems">Zeige Seiten, welche in der Navigation ausgeblendet sind</label>
<label index="hideCurrentPage">Verstecke die aktuelle Seite von der Liste</label>
<label index="showDoktypes">Zeige Seiten mit dem Doktype (kommagetrennt, leer lassen für alle)</label>
<label index="ignoreUids">Ignoriere die folgenden Seiten nach Ihrer UID (kommagetrennt)</label>
<label index="categories">Filtere nach Kategorien</label>
<label index="categoryMode">Kategorie Modus</label>
<label index="categoryMode.or">Zeige Seiten mit ausgewählten Kategorien (ODER)</label>
<label index="categoryMode.and">Zeige Seiten mit ausgewählten Kategorien (UND)</label>
<label index="categoryMode.orNot">Zeige Seiten mit ausgewählten Kategorien NICHT (ODER)</label>
<label index="categoryMode.andNot">Zeige Seiten mit ausgewählten Kategorien NICHT (UND)</label>
<label index="templateType">Template-Typ:</label>
<label index="templateType.file">HTML-Datei</label>
<label index="templateType.directory">Fluid-Template Verzeichnis</label>
<label index="templateType.preset">Vorlage</label>
<label index="templatePreset">Template Vorlage</label>
<label index="templateRootFile">Template Datei (mit Pfad)</label>
<label index="templateRootPath">Template Verzeichnis</label>
<label index="partialRootPath">Partial Verzeichnis</label>
<label index="layoutRootPath">Layout Verzeichnis</label>
</languageKey>
</data>
</T3locallang>

View File

@@ -0,0 +1,3 @@
<div class="tx-pwteaser-pi1">
<f:render section="main" />
</div>

View File

@@ -0,0 +1,13 @@
<f:form.errors>
<div class="error">
{error.message}
<f:if condition="{error.propertyName}">
<p>
<strong>{error.propertyName}</strong>:
<f:for each="{error.errors}" as="errorDetail">
{errorDetail.message}
</f:for>
</p>
</f:if>
</div>
</f:form.errors>

View File

@@ -0,0 +1,17 @@
{namespace pw=PwTeaserTeam\PwTeaser\ViewHelpers}
<f:layout name="Main" />
<f:section name="main">
<ul>
<f:for each="{pages}" as="page" iteration="iterator">
<li class="page {f:if(condition:'{iterator.isFirst}', then:' first')}{f:if(condition:'{iterator.isLast}', then:' last')}">
<f:link.page pageUid="{page.uid}" title="{page.title}">
<f:if condition="{page.media.0}">
<f:image image="{page.media.0}" alt="{page.title}" width="110" />
</f:if>
<span>{page.title}</span>
</f:link.page>
</li>
</f:for>
</ul>
</f:section>

View File

@@ -0,0 +1,12 @@
{namespace pw=PwTeaserTeam\PwTeaser\ViewHelpers}
<f:layout name="Main" />
<f:section name="main">
<ul>
<f:for each="{pages}" as="page" iteration="iterator">
<li class="page {f:if(condition:'{iterator.isFirst}', then:' first')}{f:if(condition:'{iterator.isLast}', then:' last')}">
<f:link.page pageUid="{page.uid}" title="{page.title}">{page.title}</f:link.page>
</li>
</f:for>
</ul>
</f:section>

View File

@@ -0,0 +1,94 @@
{namespace pw=PwTeaserTeam\PwTeaser\ViewHelpers}
<f:layout name="Main" />
<f:section name="main">
<div><b>How many pages found:</b> {pages -> f:count()}</div>
<f:if condition="{pages -> f:count()}">
<f:then>
<f:widget.paginate objects="{pages}" as="pageObject" configuration="{itemsPerPage: 5, insertAbove: 0, insertBelow: 1}">
<ul>
<f:for each="{pageObject}" as="page">
<li>
<fieldset>
<legend><b>Title:</b> <f:link.page pageUid="{page.uid}">{page.title}</f:link.page> <small>uid={page.uid}</small></legend>
<ul>
<li><b>isCurrentPage:</b> <f:if condition="{page.isCurrentPage}"><f:then>Yes</f:then><f:else>No</f:else></f:if></li>
<li><b>subtitle:</b> {page.subtitle}</li>
<li><b>navTitle:</b> {page.navTitle}</li>
<li><b>keywords as String:</b> {page.keywordsAsString}</li>
<li><b>keywords:</b>
<f:if condition="{page.keywords}">
<ul>
<f:for each="{page.keywords}" as="keyword" iteration="iterator">
<li{f:if(condition:'{iterator.isLast} == 1', then:' class="isLast"')}>
{keyword}
</li>
</f:for>
</ul>
</f:if>
</li>
<li><b>description:</b> {page.description}</li>
<li><b>abstract:</b> {page.abstract}</li>
<li><b>slug:</b> {page.get.slug}</li>
<li><b>media:</b>
<f:if condition="{page.media}">
<f:then>
<ul>
<f:for each="{page.media}" as="mediaFile">
<li>
<f:image image="{mediaFile}" alt="{mediaFile.title}" maxWidth="120" maxHeight="100" />
</li>
</f:for>
</ul>
</f:then>
</f:if>
</li>
<li>
<b>categories:</b>
<f:if condition="{page.categories}">
<f:then>
<ul>
<f:for each="{page.categories}" as="category">
<li>
<b>{category.title}</b> <small>uid={category.uid}</small>
<f:if condition="{category.description}">
<p>{category.description -> f:format.nl2br()}</p>
</f:if>
</li>
</f:for>
</ul>
</f:then>
</f:if>
</li>
<li><b>crdate:</b> <f:format.date date="{page.get.crdate}" format="r" /></li>
<li><b>tstamp:</b> <f:format.date date="{page.tstamp}" format="r" /></li>
<li><b>lastUpdated:</b> <f:format.date date="{page.lastupdated}" format="r" /></li>
<li><b>starttime:</b> <f:format.date date="{page.starttime}" format="r" /></li>
<li><b>endtime:</b> <f:format.date date="{page.endtime}" format="r" /></li>
<li><b>newUntil:</b> <f:format.date date="{page.newUntil}" format="r" /></li>
<li><b>isNew:</b> <f:if condition="{page.isNew}"><f:then>Yes</f:then><f:else>No</f:else></f:if></li>
<li><b>author:</b> {page.author}</li>
<li><b>authorEmail:</b> {page.authorEmail}</li>
<li><b>rootLineDepth:</b> {page.rootLineDepth}</li>
<f:if condition="{settings.loadContents}">
<li>
<b>First image (of content elements, column 0)</b>: <br />
<pw:getContent contents="{page.contents}" as="content" cType="image" index="0">
<f:image src="{content.imageFiles.0.url}" alt="{content.imageFiles.0.title}" maxWidth="150" maxHeight="50" />
</pw:getContent>
</li>
</f:if>
</ul>
</fieldset>
<br />
</li>
</f:for>
</ul>
</f:widget.paginate>
</f:then>
<f:else>
<i>This appears if the number of found pages is zero.</i>
</f:else>
</f:if>
</f:section>

View File

@@ -0,0 +1,104 @@
<f:if condition="{configuration.insertAbove}">
<f:render section="paginator" arguments="{pagination: pagination}" />
</f:if>
<f:renderChildren arguments="{contentArguments}" />
<f:if condition="{configuration.insertBelow}">
<f:render section="paginator" arguments="{pagination: pagination}" />
</f:if>
<f:section name="paginator">
<ul class="f3-widget-paginator">
<!-- First -->
<f:if condition="{f:translate(key:'pagination_first')}">
<f:if condition="{pagination.isFirstPage}">
<f:then>
<li class="first">
<span><f:translate key="pagination_first" /></span>
</li>
</f:then>
<f:else>
<li class="first">
<f:widget.link><f:translate key="pagination_first" /></f:widget.link>
</li>
</f:else>
</f:if>
</f:if>
<!-- Previous -->
<f:if condition="{f:translate(key:'pagination_previous')}">
<f:if condition="{pagination.previousPage}">
<f:then>
<li class="previous">
<f:if condition="{pagination.previousPage} > 1">
<f:then>
<!-- <f:translate key="previous" /> -->
<f:widget.link arguments="{currentPage: pagination.previousPage}"><f:translate key="pagination_previous" /></f:widget.link>
</f:then>
<f:else>
<f:widget.link><f:translate key="pagination_previous" /></f:widget.link>
</f:else>
</f:if>
</li>
</f:then>
<f:else>
<li class="previous">
<span><f:translate key="pagination_previous" /></span>
</li>
</f:else>
</f:if>
</f:if>
<!-- Numbered pages -->
<f:for each="{pagination.pages}" as="page">
<f:if condition="{page.isCurrent}">
<f:then>
<li class="current">
<span>{page.number}</span>
</li>
</f:then>
<f:else>
<li>
<f:if condition="{page.number} > 1">
<f:then>
<f:widget.link arguments="{currentPage: page.number}">{page.number}</f:widget.link>
</f:then>
<f:else>
<f:widget.link>{page.number}</f:widget.link>
</f:else>
</f:if>
</li>
</f:else>
</f:if>
</f:for>
<!-- Next -->
<f:if condition="{f:translate(key:'pagination_next')}">
<li class="next">
<f:if condition="{pagination.nextPage}">
<f:then>
<f:widget.link arguments="{currentPage: pagination.nextPage}"><f:translate key="pagination_next" /></f:widget.link>
</f:then>
<f:else>
<span><f:translate key="pagination_next" /></span>
</f:else>
</f:if>
</li>
</f:if>
<!-- Last -->
<f:if condition="{f:translate(key:'pagination_last')}">
<li class="last">
<f:if condition="{pagination.isLastPage}">
<f:then>
<span><f:translate key="pagination_last" /></span>
</f:then>
<f:else>
<f:widget.link arguments="{currentPage: pagination.lastPage}"><f:translate key="pagination_last" /></f:widget.link>
</f:else>
</f:if>
</li>
</f:if>
</ul>
</f:section>

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

View File

@@ -0,0 +1,15 @@
{
"name": "t3/pw_teaser",
"type": "typo3-cms-extension",
"description": "Create powerful, dynamic page teasers with data from page properties and its content elements. Based on Extbase and Fluid Template Engine.",
"homepage": "http://typo3.org",
"license": "GPL-2.0",
"require": {
"typo3/cms-core": "^9.5.20 || ^10.4.6"
},
"autoload": {
"psr-4": {
"PwTeaserTeam\\PwTeaser\\": "Classes"
}
}
}

View File

@@ -0,0 +1,45 @@
<?php
/***************************************************************
* Extension Manager/Repository config file for ext "pw_teaser".
*
* Auto generated 15-07-2022 12:26
*
* Manual updates:
* Only the data in the array - everything else is removed by next
* writing. "version" and "dependencies" must not be touched!
***************************************************************/
$EM_CONF[$_EXTKEY] = array (
'title' => 'Page Teaser (with Fluid)',
'description' => 'Create powerful, dynamic page teasers with data from page properties and its content elements. Based on Extbase and Fluid Template Engine.',
'category' => 'plugin',
'version' => '5.0.1',
'state' => 'stable',
'author' => 'Armin Vieweg',
'author_email' => 'info@v.ieweg.de',
'author_company' => 'v.ieweg Webentwicklung',
'constraints' =>
array (
'depends' =>
array (
'typo3' => '9.5.0-10.4.99',
),
'conflicts' =>
array (
),
'suggests' =>
array (
),
),
'autoload' =>
array (
'psr-4' =>
array (
'PwTeaserTeam\\PwTeaser\\' => 'Classes',
),
),
'uploadfolder' => false,
'clearcacheonload' => false,
);

View File

@@ -0,0 +1,42 @@
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'PwTeaserTeam.' . 'pw_teaser',
'Pi1',
[
'Teaser' => 'index',
]
);
$rootLineFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
',',
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'],
true
);
$rootLineFields[] = 'sorting';
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = implode(',', $rootLineFields);
if (TYPO3_MODE === 'BE') {
/** @var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Imaging\IconRegistry');
$iconRegistry->registerIcon(
'ext-pwteaser-wizard-icon',
'TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider',
['source' => 'EXT:pw_teaser/Resources/Public/Icons/Extension_x2.png']
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
mod.wizards.newContentElement.wizardItems.plugins.elements.pwteaser {
iconIdentifier = ext-pwteaser-wizard-icon
title = LLL:EXT:pw_teaser/Resources/Private/Language/locallang.xml:newContentElementWizardTitle
description = LLL:EXT:pw_teaser/Resources/Private/Language/locallang.xml:newContentElementWizardDescription
tt_content_defValues {
CType = list
list_type = pwteaser_pi1
}
}
');
}

View File

@@ -0,0 +1,38 @@
plugin.tx_pwteaser {
persistence {
classes {
PwTeaserTeam\PwTeaser\Domain\Model\Page {
mapping {
tableName = pages
columns {
nav_title.mapOnProperty = navTitle
author_email.mapOnProperty = authorEmail
tstamp.mapOnProperty = tstamp
crdate.mapOnProperty = creationDate
lastUpdated.mapOnProperty = lastUpdated
starttime.mapOnProperty = starttime
endtime.mapOnProperty = endtime
newUntil.mapOnProperty = newUntil
sorting.mapOnProperty = sorting
l18n_cfg.mapOnProperty = l18nConfiguration
}
}
}
PwTeaserTeam\PwTeaser\Domain\Model\Content {
mapping {
tableName = tt_content
columns {
pid.mapOnProperty = pid
colPos.mapOnProperty = colPos
CType.mapOnProperty = ctype
tstamp.mapOnProperty = tstamp
crdate.mapOnProperty = crdate
}
}
}
}
storagePid =
}
}