Suggestion #9179

Tx_Fluid_ViewHelpers_Form_RteViewHelper

Added by Frank Frewer about 11 years ago. Updated over 8 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Start date:
2010-08-06
Due date:
% Done:

0%

Estimated time:
Has patch:
No
Tags:

Description

With the attached RteViewHelper.php (Tx_Fluid_ViewHelpers_Form_RteViewHelper) it is possible to render a form field with the rtehtmlarea.

Due to the fact that rtehtmlarea needs to make some modifications to the form tag (attribute "onsubmit") and adds some js before and beyond the form, it is necessary to modify the FormViewhelper.php (see attached patch_FormViewHelper.diff based on FormViewHelper.php in https://svn.typo3.org/TYPO3v4/CoreProjects/MVC/fluid/trunk/ Revision 2522).
With this modifications the FormViewHelper gets the needed JS for all Rte form fields from the viewHelperVariableContainer which is filled in by the RteViewHelper and adds this to the returned content.

I'm working with extbase/fluid just since two weeks. So I hope my suggestion matches your coding guidelines. If not, please tell me, what could be better.

I didn't attach now files for v5. If you are interested i can do that later.

Note:
In conjunction with extensions based an extbase / fluid the RTE produces tags with ID's which are not valid:
<div id="pleasewaittx_meyxt_pi1[myobject][myfield] ...
<div id="editorWraptx_meyxt_pi1[myobject][myfield] ...
<textarea id="RTEareatx_meyxt_pi1[myobject][myfield] ...

The W3C Markup Validator says:
character "[" is not allowed in the value of attribute "id"

This happens in backend and frontend.

I reported this already to the bugtracker: http://bugs.typo3.org/view.php?id=15326


Files

RteViewHelper.php (7.52 KB) RteViewHelper.php Frank Frewer, 2010-08-06 11:29
patch_FormViewHelper.diff (1.41 KB) patch_FormViewHelper.diff Frank Frewer, 2010-08-06 11:29
RteViewHelper.php (5.92 KB) RteViewHelper.php New version Frank Frewer, 2010-08-13 14:59
RteConfiguration.php (8.88 KB) RteConfiguration.php Frank Frewer, 2010-08-13 14:59
ScriptViewHelper.php (7.21 KB) ScriptViewHelper.php Frank Frewer, 2010-08-13 14:59
#1

Updated by Bastian Waidelich about 11 years ago

  • Status changed from New to Accepted
  • Assignee set to Bastian Waidelich
#2

Updated by Frank Frewer about 11 years ago

Hi Bastian,

according to the feedback you gave me in the newslist (http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2010-August/006220.html et al.) I modified the coding.

The result is, that I created a new Script VH which has to wrap the Form VH to prepend/append the required JavaScripts to the form. With the Script VH it is not anymore necessary to modify Form VH.
And, of course, this VH could be used by other VH too.

Additionally I wrote a intermediate class Tx_Fluid_Classes_Core_ViewHelper_RteConfiguration.
At the moment this class will probably not work with rte in backend modules because the class tx_rtehtmlarea_pi2 is, if I'm not wrong, especially for the frontend. But if you agree to the general concept of my class, it might be possible to extend the functionality. The onsubmit JavaScript I put as an event handler to the JavaScript beyond the form.

regards,

Frank

#3

Updated by Jonas Götze about 11 years ago

Hi,

It seems that there has been a change in current Fluid trunk which leads to an error with this wonderful view Helper.
The key of the formname in the viewHelperVariableContainer has to be 'formObjectName' instead of 'formName' (see RteViewHelper.php on line 95).

Regards,
Jonas

#4

Updated by Bastian Waidelich over 9 years ago

  • Status changed from Accepted to New
  • Assignee deleted (Bastian Waidelich)
  • Has patch set to No

Also available in: Atom PDF