Skip to content

Commit

Permalink
Merge branch 'master' into fixes/649
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszuznanski authored Oct 2, 2023
2 parents a0ae083 + 7d5a90e commit 31cba47
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Classes/DataProcessing/DatabaseQueryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* bodytext = TEXT
* bodytext {
* field = bodytext
* parseFunc =< lib.parseFunc_links
* parseFunc =< lib.parseFunc_RTE
* }
* link = TEXT
* link {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

class AfterCacheableContentIsGeneratedListener
{
public function __construct(private readonly JsonEncoder $encoder)
{
}
public function __construct(private readonly JsonEncoder $encoder) {}

public function __invoke(AfterCacheableContentIsGeneratedEvent $event)
{
Expand Down
3 changes: 1 addition & 2 deletions Classes/Event/Listener/AfterLinkIsGeneratedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ final class AfterLinkIsGeneratedListener
public function __construct(
private readonly HeadlessFrontendUrlInterface $urlUtility,
private readonly LinkService $linkService
) {
}
) {}

public function __invoke(AfterLinkIsGeneratedEvent $event): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

final class AfterPagePreviewUriGeneratedListener
{
public function __construct(private readonly HeadlessFrontendUrlInterface $urlUtility)
{
}
public function __construct(private readonly HeadlessFrontendUrlInterface $urlUtility) {}

public function __invoke(AfterPagePreviewUriGeneratedEvent $event): void
{
Expand Down
4 changes: 1 addition & 3 deletions Classes/Form/Decorator/FormDefinitionDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@

namespace FriendsOfTYPO3\Headless\Form\Decorator;

class FormDefinitionDecorator extends AbstractFormDefinitionDecorator
{
}
class FormDefinitionDecorator extends AbstractFormDefinitionDecorator {}
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/DomainViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function renderStatic(
case 'frontendBase':
return $urlUtility->getFrontendUrl();
case 'proxyUrl':
return $urlUtility->getProxyUrl();
return $urlUtility->getProxyUrl();
case 'storageProxyUrl':
return $urlUtility->getStorageProxyUrl();
}
Expand Down
23 changes: 1 addition & 22 deletions Configuration/TypoScript/ContentElement/Shortcut.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tt_content.shortcut {
fields {
content {
fields {
shortcut = COA
shortcut =< lib.renderChildren
shortcut {
10 = RECORDS
10 {
Expand All @@ -13,27 +13,6 @@ tt_content.shortcut {
tt_content.stdWrap.wrap = |###BREAK###
}
}
stdWrap {
innerWrap = [|]
split {
token = ###BREAK###
cObjNum = 1 |*|2|*| 3
1 {
current = 1
stdWrap.wrap = |
}

2 {
current = 1
stdWrap.wrap = ,|
}

3 {
current = 1
stdWrap.wrap = |
}
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TypoScript/ContentElement/Text.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tt_content.text {
bodytext = TEXT
bodytext {
field = bodytext
parseFunc =< lib.parseFunc_links
parseFunc =< lib.parseFunc_RTE
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tt_content.textmedia {
bodytext = TEXT
bodytext {
field = bodytext
parseFunc =< lib.parseFunc_links
parseFunc =< lib.parseFunc_RTE
}
gallery = TEXT
gallery {
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TypoScript/ContentElement/Textpic.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tt_content.textpic {
bodytext = TEXT
bodytext {
field = bodytext
parseFunc =< lib.parseFunc_links
parseFunc =< lib.parseFunc_RTE
}
gallery = TEXT
gallery {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,40 @@ lib {
makelinks {
http {
keep = {$styles.content.links.keep}
extTarget.data = parameters:target
extTarget = {$styles.content.links.extTarget}
}

mailto {
keep = path
}
}

tags {
link = TEXT
link {
current = 1
typolink {
parameter.data = parameters : allParams
extTarget.data = parameters:target
}
parseFunc.constants = 1
}
a = TEXT
a {
current = 1
typolink {
parameter.data = parameters:href
title.data = parameters:title
ATagParams.data = parameters:allParams
target.data = parameters:target
extTarget.data = parameters:target
# the target attribute takes precedence over config.intTarget
target.ifEmpty.data = parameters:target
# the target attribute takes precedence over the constant (styles.content.links.extTarget)
# which takes precedence over config.extTarget
# do not pass extTarget as reference, as it might not be set resulting in the string being
# written to the target attribute
extTarget {
ifEmpty < config.extTarget
ifEmpty.override = {$styles.content.links.extTarget}
override.data = parameters:target
}
}
}
}

allowTags = {$styles.content.allowTags}
denyTags = *
sword = <span class="ce-sword">|</span>
# @deprecated since TYPO3 v12, remove with v13
constants = 1
nonTypoTagStdWrap {
HTMLparser = 1
Expand All @@ -51,19 +54,22 @@ lib {
parseFunc_RTE < lib.parseFunc
parseFunc_RTE {
# Processing <ol>, <ul> and <table> blocks separately
externalBlocks = article, aside, blockquote, div, dd, dl, footer, header, nav, ol, section, table, ul, pre
externalBlocks = article, aside, blockquote, div, dd, dl, footer, header, nav, ol, section, table, ul, pre, figure
externalBlocks {
ol {
stripNL = 1
stdWrap.parseFunc = < lib.parseFunc
stdWrap.parseFunc =< lib.parseFunc
}

ul {
stripNL = 1
stdWrap.parseFunc = < lib.parseFunc
stdWrap.parseFunc =< lib.parseFunc
}

pre {
stdWrap.parseFunc < lib.parseFunc
}

table {
stripNL = 1
stdWrap {
Expand All @@ -74,25 +80,34 @@ lib {
always = 1
list = contenttable
}

keepNonMatchedTags = 1
}
}

HTMLtableCells = 1
HTMLtableCells {
# Recursive call to self but without wrapping non-wrapped cell content
default.stdWrap {
parseFunc = < lib.parseFunc_RTE
parseFunc.nonTypoTagStdWrap.encapsLines.nonWrappedTag =
parseFunc =< lib.parseFunc_RTE
parseFunc.nonTypoTagStdWrap.encapsLines {
nonWrappedTag =
innerStdWrap_all.ifBlank =
}
}

addChr10BetweenParagraphs = 1
}
}

div {
stripNL = 1
callRecursive = 1
}

article < .div
aside < .div
figure < .div
blockquote < .div
footer < .div
header < .div
Expand All @@ -101,20 +116,23 @@ lib {
dl < .div
dd < .div
}

nonTypoTagStdWrap {
HTMLparser = 1
HTMLparser {
keepNonMatchedTags = 1
htmlSpecialChars = 2
}

encapsLines {
encapsTagList = p,pre,h1,h2,h3,h4,h5,h6,hr,dt
remapTag.DIV = P
nonWrappedTag = P
innerStdWrap_all.ifBlank = &nbsp;
}
HTMLparser = 1
HTMLparser {
keepNonMatchedTags = 1
htmlSpecialChars = 2
}
}
}

parseFunc_links {
htmlSanitize = 1
tags {
Expand All @@ -125,8 +143,10 @@ lib {
parameter.data = parameters : allParams
extTarget.data = parameters:target
}

parseFunc.constants = 1
}

a = TEXT
a {
current = 1
Expand Down
44 changes: 44 additions & 0 deletions Configuration/TypoScript/Helpers/RenderChildren.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* This lib renders children in headless.
* To use this code copy code below and replace FIELDNAME and TABLENAME with correct values for relation
*
children =< lib.renderChildren
children.10 {
source.field = FIELDNAME
tables = TABLENAME
conf.TABLENAME.stdWrap.wrap = |###BREAK###
}
*
*/

lib.renderChildren = COA
lib.renderChildren {
10 = RECORDS
stdWrap {
innerWrap = [|]
split {
token = ###BREAK###
cObjNum = 1 |*|2|*| 3
1 {
current = 1
stdWrap {
wrap = |
}
}

2 {
current = 1
stdWrap {
wrap = ,|
}
}

3 {
current = 1
stdWrap {
wrap = |
}
}
}
}
}
2 changes: 2 additions & 0 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ plugin.tx_headless {

## Include page
@import "EXT:headless/Configuration/TypoScript/Page/*.typoscript"
## Include helpers
@import "EXT:headless/Configuration/TypoScript/Helpers/*.typoscript"
## Include content elements
@import "EXT:headless/Configuration/TypoScript/ContentElement/*.typoscript"
## Include configuration
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Developer/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ object with a header definition `lib.contentElementWithHeader`:
bodytext = TEXT
bodytext {
field = bodytext
parseFunc =< lib.parseFunc_links
parseFunc =< lib.parseFunc_RTE
}
demoSubfields {
fields {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/ContentObject/DataProcessingExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public function process(

$processedData[$targetVariableName] = ['SomeCustomProcessing'];

return $processedData;
return $processedData;
}
}
2 changes: 1 addition & 1 deletion Tests/Unit/ContentObject/EmptyDataProcessingExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public function process(

$processedData[$targetVariableName] = [null];

return $processedData;
return $processedData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

class TestSiteProvider implements SiteProviderInterface
{
public function prepare(array $config, int $siteUid)
{
}
public function prepare(array $config, int $siteUid) {}

public function getSites(): array
{
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"ext-json": "*",
"typo3/cms-core": "^12.4",
"typo3/cms-install": "^12.4",
"typo3/coding-standards": "^0.7.1"
"typo3/coding-standards": "dev-main"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.15.0",
Expand Down

0 comments on commit 31cba47

Please sign in to comment.