/** * 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\\Fluid\\Core\\Widget\\AbstractWidgetViewHelper', 'nextWidgetNumber')) { $widgetCounter = 0; } else { $widgetCounter = $this->viewHelperVariableContainer->get('TYPO3\\Fluid\\Core\\Widget\\AbstractWidgetViewHelper', 'nextWidgetNumber'); } $widgetIdentifier = '@widget_' . $widgetCounter; $this->viewHelperVariableContainer->addOrUpdate('TYPO3\\Fluid\\Core\\Widget\\AbstractWidgetViewHelper', '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 */ private function initializeWidgetIdentifier() { $widgetIdentifier = $this->hasArgument('widgetId') ? $this->arguments['widgetId'] : strtolower(str_replace('\\', '-', get_class($this))); $this->widgetContext->setWidgetIdentifier($widgetIdentifier); }
/** * @test */ public function widgetIdentifierCanBeReadAgain() { $this->widgetContext->setWidgetIdentifier('myWidgetIdentifier'); $this->assertEquals('myWidgetIdentifier', $this->widgetContext->getWidgetIdentifier()); }