Project

General

Profile

Actions

Bug #75315

closed

Wrong inline array notation in ContainerViewHelper docs

Added by Thomas Noest over 8 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2016-03-30
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I got this in f:be.container with includeCssFiles= and includeJsFiles= (notation found on https://fluidtypo3.org/viewhelpers/fluid/master/Be/ContainerViewHelper.html @all review Options)

"0: '{f:uri.resource(path:\'Css/Styles.css\')}'" gets outputted as string in the response. Debugging this I found that it gets labeled as a TextNode in Classes/Core/Parser/TemplateParser.php in function textAndShorthandSyntaxHandler(). I got it working with this patch:

} elseif ($context === self::CONTEXT_INSIDE_VIEWHELPER_ARGUMENTS && preg_match(self::$SCAN_PATTERN_SHORTHANDSYNTAX_ARRAYS, $section, $matchedVariables) > 0) {
// We only match arrays if we are INSIDE viewhelper arguments
$this->arrayHandler($state, $matchedVariables['Array']);

}

// Thomas Patch
elseif ($context === self::CONTEXT_INSIDE_VIEWHELPER_ARGUMENTS && preg_match(self::$SPLIT_PATTERN_SHORTHANDSYNTAX_ARRAY_PARTS, $section, $matchedVariables) > 0) {
// We only match arrays if we are INSIDE viewhelper arguments
$this->arrayHandler($state, $matchedVariables['ArrayPart']);
}
// END Thomas Patch END

else {
$this->textHandler($state, $section);
}

This works, but I am new to this and have not much more in my templates. As far as I can see, this is not constraint to be.container, so it could squat more bugs. But that, and if my patch is the right direction, is for a more knowledgeable person to decide!

Actions #1

Updated by Markus Klein over 8 years ago

  • Status changed from New to Needs Feedback

Seems like the page your referenced contains wrong examples.

array syntax basically follows JSON, so an attribute, which requires an array must look like this:

includeCssFiles="{0: 'file1.css', 1: '{f:uri.resource(path:\'Css/Styles.css\')}'}" 

Note the additional set of {} around the value of the attribute.

Actions #2

Updated by Markus Klein over 8 years ago

An example where the Core is using this: https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_6-2/typo3/sysext/beuser/Resources/Private/Layouts/Default.html#L1

Moreover, if you write a BE module for CMS 7+, consider using the ModuleTemplate API instead of this old view helper.

Actions #3

Updated by Thomas Noest over 8 years ago

The additional set of {} makes it work. You can close this one.

As for ModuleTemplate, I wouldn't know where to start.

Thanks for your time!

Actions #4

Updated by Markus Klein over 8 years ago

  • Status changed from Needs Feedback to Closed
Actions #5

Updated by Thomas Noest over 8 years ago

Opened an issue about the wrong doc at fluidtypo3, where they told me that the doc is generated from fluids own docblock.

And that's right, the wrong declaration is in:

Fluid/Classes/ViewHelpers/Be/ContainerViewHelper.php line 41

Should this go in a new issue, or is this enough?

Actions #6

Updated by Markus Klein over 8 years ago

  • Subject changed from Inline array notation not parsed to Wrong inline array notation in ContainerViewHelper docs
  • Status changed from Closed to Accepted

Can you push a patch?

Actions #7

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47522

Actions #8

Updated by Gerrit Code Review over 8 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47522

Actions #9

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47527

Actions #10

Updated by Wouter Wolters over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #11

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF