[FLOW3-general] Embed forms for IRRE like editing?
Sebastian Kurfürst
sebastian at typo3.org
Wed Apr 6 17:32:47 CEST 2011
Hey Tolleiv,
unfortunately there is no easy solution yet. However, the following are
the needed steps I think:
First, we'd need a new ViewHelper
<f:form.multipleObjects property="bars">, which could be used like so:
<f:form method="post" action="update" name="foo" object="{foo}">
...
<f:form.textbox property="property" />
...
<f:form.multipleObjects property="bars">
<f:form.textbox property="property" />
</f:form.multipleObjects>
<f:form.submit value="Update" />
</f:form>
This ViewHelper would need to extend AbstractFormFieldViewHelper and
roughly need to do the following:
$i = 0;
$output = '';
foreach ($this->getValue() as $v) {
1) Adjust fieldNamePrefix in ViewHelperVariableContainer, by appending:
[bars][$i]
2) override 'formObject' in ViewHelperVariableContainer to $v
3) $output .= $this->renderChildren();
}
// reset formObject and fieldNamePrefix to old values
// I guess it would also need to output the identity of the objects in
// the loop...
return $output;
This should generate a nested array like:
foo[__identity] = ...
foo[property1] = ....
foo[bars][0][__identity] = ...
foo[bars][0][xy] = ...
Furthermore, make sure to try it out with the new trunk, where the
property mapper refactoring has landed.
Unfortunately I do not have time right now to implement this (still one
exam left for which I need to learn quite a bit...), but maybe somebody
wants to try out :-)
Greets,
Sebastian
More information about the FLOW3-general
mailing list