/** * 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 * @todo clean up, and make it somehow more routing compatible. */ private function initializeWidgetIdentifier() { $widgetCounter = $this->viewHelperVariableContainer->get(\TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper::class, 'nextWidgetNumber', 0); $widgetIdentifier = '@widget_' . $widgetCounter; $this->viewHelperVariableContainer->addOrUpdate(\TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper::class, 'nextWidgetNumber', $widgetCounter + 1); $this->widgetContext->setWidgetIdentifier($widgetIdentifier); }
/** * 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 * @todo clean up, and make it somehow more routing compatible. */ private function initializeWidgetIdentifier() { if (!$this->viewHelperVariableContainer->exists('TYPO3\\CMS\\Fluid\\Core\\Widget\\AbstractWidgetViewHelper', 'nextWidgetNumber')) { $widgetCounter = 0; } else { $widgetCounter = $this->viewHelperVariableContainer->get('TYPO3\\CMS\\Fluid\\Core\\Widget\\AbstractWidgetViewHelper', 'nextWidgetNumber'); } $widgetIdentifier = '@widget_' . $widgetCounter; $this->viewHelperVariableContainer->addOrUpdate('TYPO3\\CMS\\Fluid\\Core\\Widget\\AbstractWidgetViewHelper', 'nextWidgetNumber', $widgetCounter + 1); $this->widgetContext->setWidgetIdentifier($widgetIdentifier); }
/** * @test */ public function widgetIdentifierCanBeReadAgain() { $this->widgetContext->setWidgetIdentifier('myWidgetIdentifier'); $this->assertEquals('myWidgetIdentifier', $this->widgetContext->getWidgetIdentifier()); }