Bug #47006

widget identifier are not unique

Added by Christoph Bauer over 2 years ago. Updated 8 months ago.

Status:New Start date:2013-04-06
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:-
Target version:-
Has patch:No Affected Flow version:(any)

Description

currently widget identifiers are unique only within the scope of a single plugin, but not the whole called page.
I tried using multiple instances of the same plugin - all using the paginate widget - on the same page, but since all paginate widgets get the same identifier, this has some unwanted side-effects (switching the shown page of one paginate widget affects all other widgets too etc.)

History

#1 Updated by Kevin Jäck 11 months ago

Christoph Bauer wrote:

currently widget identifiers are unique only within the scope of a single plugin, but not the whole called page.
I tried using multiple instances of the same plugin - all using the paginate widget - on the same page, but since all paginate widgets get the same identifier, this has some unwanted side-effects (switching the shown page of one paginate widget affects all other widgets too etc.)

I think this feature should get a higher priority.
One example from one of my projects. I had following requirements.
Develop a teaser extension with which it is possible to get all tt_contents elements from specific sys_categories. This plugin must be placed multiple on one page for each category. With the current Typo3 version i´m not able to provide this with standard extbase and fluid.
All urls look like Christoph said: tx_teasercontent_teasercontentanzeige[%40widget_0].
A patch i didn´t found.

#2 Updated by Kevin Jäck 11 months ago

In the fluid package in Typo3 FLow 2.2.2, this behaviour has been changed. There it is possible to pass the widgetId as an argument.

namespace TYPO3\Fluid\Core\Widget;
In class: AbstractWidgetViewHelper.php
/**
 * The widget identifier is unique on the current page, and is used
 * in the URI as a namespace for the widget's arguments.
 *
 * @return string the widget identifier for this widget
 * @return void
 */
private function initializeWidgetIdentifier() {
    $widgetIdentifier = ($this->hasArgument('widgetId') ? $this->arguments['widgetId'] : strtolower(str_replace('\\', '-', get_class($this))));
    $this->widgetContext->setWidgetIdentifier($widgetIdentifier);
}

Maybe this feature also can be used in Typo3 CMS?

#3 Updated by M. Ecker 8 months ago

I can confirm the need to solve this.
The private method initializeWidgetIdentifier of AbstractWidgetViewHelper should generate an unique identifier by counting up nextWidgetNumber in viewHelperVariableContainer, but does not since it cannot access the nextWidgetNumber set by another Widget. The widgetCounter stays always at 0.

Also available in: Atom PDF