From 0feb7c46fd6b36ae56cdfcb47188f79b3b86480f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 13 Dec 2019 13:27:25 +0100 Subject: [PATCH] Add page / blog post images to output Also move as in dataprocessing always to top, to show it in folded vim. --- .../ContentElements/MenuAbstract.typoscript | 12 +++++++++--- Configuration/TypoScript/Setup/Page.typoscript | 18 ++++++++++++------ Resources/Private/Partials/Image.html | 8 ++++++++ Resources/Private/Partials/Menu/Page.html | 4 ++++ .../Templates/ContentElements/Image.html | 5 +---- Resources/Private/Templates/Page/BlogPost.html | 4 ++++ 6 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 Resources/Private/Partials/Image.html diff --git a/Configuration/TypoScript/Setup/ContentElements/MenuAbstract.typoscript b/Configuration/TypoScript/Setup/ContentElements/MenuAbstract.typoscript index ddaa3bf..2542b28 100644 --- a/Configuration/TypoScript/Setup/ContentElements/MenuAbstract.typoscript +++ b/Configuration/TypoScript/Setup/ContentElements/MenuAbstract.typoscript @@ -13,6 +13,7 @@ tt_content.menu_abstract { dataProcessing { 10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor 10 { + as = compatibleWith selectFields = sys_category.* table = sys_category pidInList = 2 @@ -20,13 +21,18 @@ tt_content.menu_abstract { where.insertData = 1 leftjoin = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid orderBy = sorting - as = compatibleWith } 11 < .10 11 { - where = sys_category_record_mm.uid_foreign = {field:uid} AND sys_category.parent = 1 as = topics + where = sys_category_record_mm.uid_foreign = {field:uid} AND sys_category.parent = 1 + } + + 100 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor + 100 { + as = media + references.fieldName = media } } } @@ -44,6 +50,7 @@ tt_content.menu_abstract { 500 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor 500 { + as = topic if { value = 100 equals.field = layout @@ -57,7 +64,6 @@ tt_content.menu_abstract { intval = 1 } } - as = topic } } diff --git a/Configuration/TypoScript/Setup/Page.typoscript b/Configuration/TypoScript/Setup/Page.typoscript index 5992984..8f63eb3 100644 --- a/Configuration/TypoScript/Setup/Page.typoscript +++ b/Configuration/TypoScript/Setup/Page.typoscript @@ -38,23 +38,24 @@ page { dataProcessing { 10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor 10 { + as = assignedTopics table = sys_category pidInList = 2 where = sys_category_record_mm.uid_foreign = {page:uid} AND sys_category.parent = 1 where.insertData = 1 leftjoin = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid orderBy = count DESC, sys_category.title ASC - as = assignedTopics } 11 < .10 11 { + as = compatibleWith where = sys_category_record_mm.uid_foreign = {page:uid} AND sys_category.parent = 2 orderBy = sorting - as = compatibleWith } 50 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor 50 { + as = pageSections special = list special.value.data = page:uid dataProcessing { @@ -67,29 +68,34 @@ page { orderBy = sorting } } - as = pageSections } 100 < .10 100 { + as = allTopics selectFields = sys_category.*, count(sys_category_record_mm.uid_foreign) as count where = sys_category.parent = 1 AND sys_category_record_mm.uid_foreign IS NOT NULL groupBy = sys_category.uid - as = allTopics } 101 < .100 101 { + as = allTypo3Compatible where = sys_category.parent = 2 AND sys_category_record_mm.uid_foreign IS NOT NULL orderBy = sorting - as = allTypo3Compatible + } + + 500 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor + 500 { + as = media + references.fieldName = media } 1000 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor 1000 { + as = footerMenu special = list special.value = 3 levels = 2 - as = footerMenu } } diff --git a/Resources/Private/Partials/Image.html b/Resources/Private/Partials/Image.html new file mode 100644 index 0000000..08e51cb --- /dev/null +++ b/Resources/Private/Partials/Image.html @@ -0,0 +1,8 @@ + + +
+ +
Figure i{image.originalFile.uid}: {image.description}
+
+ diff --git a/Resources/Private/Partials/Menu/Page.html b/Resources/Private/Partials/Menu/Page.html index 95f4720..8cfe3fd 100644 --- a/Resources/Private/Partials/Menu/Page.html +++ b/Resources/Private/Partials/Menu/Page.html @@ -10,6 +10,10 @@ {page.data.abstract -> f:format.html()} + + {f:render(partial: 'Image', arguments: {image: page.media.0})} + + diff --git a/Resources/Private/Templates/ContentElements/Image.html b/Resources/Private/Templates/ContentElements/Image.html index d95f5d0..e0ef37b 100644 --- a/Resources/Private/Templates/ContentElements/Image.html +++ b/Resources/Private/Templates/ContentElements/Image.html @@ -5,10 +5,7 @@ -
- -
Figure i{image.originalFile.uid}: {image.description}
-
+ {f:render(partial: 'Image', arguments: {image: image})}
diff --git a/Resources/Private/Templates/Page/BlogPost.html b/Resources/Private/Templates/Page/BlogPost.html index fe4513b..c7d5961 100644 --- a/Resources/Private/Templates/Page/BlogPost.html +++ b/Resources/Private/Templates/Page/BlogPost.html @@ -20,6 +20,10 @@ {data.abstract -> f:format.html()} {introduction -> f:format.raw()} + + {f:render(partial: 'Image', arguments: {image: media.0})} + + {contentMain -> f:format.raw()}