[TYPO3-mvc] How to make prependOption work without hacking fluid

Bastian Waidelich bastian at typo3.org
Tue Feb 15 18:01:09 CET 2011


Visay Keo wrote:

Hi,

>  From the previous post of this list, I hacked fluid to register new
> argument "prependOption" to selectViewHelper and it's always there and
> working. Whenever fluid is updated, I have to remind myself about adding
> that.

You have several options:
The quickest is probably to copy the modified ViewHelper to your 
extension and use that like:
{namespace x=Tx_YourExtension_ViewHelpers}
<x:form.select [...]

The other option could be, to add the empty option in your controller 
already:

$clients = $this->clientRepository->findAll()->toArray();
array_unshift($clients, array('' => 'please select'));
$this->view->assign('clients', $clients);

[...]

<f:form.select options="{clients}" [...]


I know that both ways are not perfect. But rest assured that the next 
version will have this feature!

Best,
Bastian


More information about the TYPO3-project-typo3v4mvc mailing list