« Previous | Next » 

Revision e4507941


Added by Stephan Schuler over 10 years ago

[FEATURE] Widgets: Reset WidgetViewHelpers when being reused from ViewHelperNode

  • Introduce an AbstractViewHelper::resetState method to handle any kind
    of statefull interaction, empty by default.
  • Make ViewHelperNode call resetState when reusing a ViewHelper, and also
    call it when reusing it in a compiled template.
  • AbstractWidgetViewHelper implements resetState for creating a new
    WidgetContext object.

As ViewHelpers are supposed to be stateless they were create once per
RenderingContext and reused whenever the RenderingContext fits.
Some ViewHelpers are not stateless, e.g. AJAX widgets.

AJAX widgets push their WidgetContext into an AjaxWidgetContextHolder
before they get rendered.

As soon as AJAX-WidgetViewHelpers were used multiple times within the
same RenderingContext (widgets in ForViewHelpers for example) differet
widgets share the same ViewHelper containing the same WidgetContext.
Because the WidgetContext contains all statefull information about a
widget, only the last rendered widget gets stored in the ContextHolder.
That makes equal AJAX widgets within a for-loop impossible because
each GUI representation interacts with only the last rendered PHP object.

A test case has been committed to Viewhelpertest with http://review.typo3.org/6594

Resolves: #31667
Release: 1.0, 1.1
Change-Id: I543fd9771b3c5f9d7b9693980f3b1c17dff28996

  • added
  • modified
  • copied
  • renamed
  • deleted