Bug #47006

widget identifier are not unique

Added by Christoph Bauer over 6 years ago. Updated over 2 years ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2013-04-06
Due date:
% Done:

0%

Has patch:
No

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.)


Related issues

Duplicated by TYPO3 Core - Feature #77228: Make the widget parameter used by fluid widgets configurable Rejected 2016-07-23

History

#1 Updated by Kevin Jäck almost 5 years 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 almost 5 years 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 over 4 years 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.

#4 Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51518

#5 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51518

#6 Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51518

#7 Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51518

#8 Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51518

#9 Updated by Marco Huber over 2 years ago

Is there any chance that this patch gets backportet to 7.6? It's small, doesn't break anything and resolves a really annoying problem...

Also available in: Atom PDF