Feature #38147

Suggested addition to SelectViewHelper - allowing prepend/append of child content to rendered option tag list

Added by Claus Due about 3 years ago. Updated over 2 years ago.

Status:Closed Start date:2011-05-03
Priority:Should have Due date:
Assigned To:Claus Due % Done:

0%

Category:ViewHelpers
Target version:TYPO3 Flow Base Distribution - 2.0 beta 1
Has patch:No

Description

This is a simple but functional and useful addition to the SelectViewHelper. It adds two new boolean attributes: prependContent and appendContent. Setting one of these to TRUE (with preference for prependContent if both are TRUE) makes the ViewHelper either append of prepend the innerHTML.

It also removes the REQUIRED annotation from the $options tag - explanation of why this is good follows.

<f:form.select prependContent="TRUE">
    <option value="-1">I am the first value</option>
</f:form.select>
// outputs...
<select ...>
    <option value="-1">I am the first value</option>
    <option...> // all further options
</select>

Of course appendContent=TRUE places the first option below the others, not above.

Set to "should have" (but maybe should be "must have") because the select ViewHelper sorely lacks customization options (such as prefix to labels, special classes for special options etc) and this method allows 100% control over how options are rendered by simply leaving out the "options" argument and manually rendering the content of the select tag. Without this patch the only method of doing this is through Javascript which is complete overkill.

The logic should be solid enough to advocate the change of the options argument. It should make complete sense to the developer that, if options are left out, they either need to be supplied as an argument as per the Fluid standard - or defined as the content of the tag as per the HTML standard.

Patch performed on 4.5.2 sysext fluid source.

History

#1 Updated by Karsten Dambekalns about 3 years ago

  • Category set to ViewHelpers
  • Assigned To set to Claus Due
  • Target version set to 2.0 beta 1
  • % Done changed from 100 to 0

#2 Updated by Gerrit Code Review about 3 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/2113

#3 Updated by Gerrit Code Review about 3 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/2113

#4 Updated by Karsten Dambekalns over 2 years ago

  • Status changed from Under Review to Closed

Change has been abandoned.

Also available in: Atom PDF