/** * 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 * @author Sebastian Kurfürst <*****@*****.**> * @return void * @todo clean up, and make it somehow more routing compatible. */ private function initializeWidgetIdentifier() { if (!$this->viewHelperVariableContainer->exists('Tx_Fluid_Core_Widget_AbstractWidgetViewHelper', 'nextWidgetNumber')) { $widgetCounter = 0; } else { $widgetCounter = $this->viewHelperVariableContainer->get('Tx_Fluid_Core_Widget_AbstractWidgetViewHelper', 'nextWidgetNumber'); } $widgetIdentifier = '__widget_' . $widgetCounter; $this->viewHelperVariableContainer->addOrUpdate('Tx_Fluid_Core_Widget_AbstractWidgetViewHelper', 'nextWidgetNumber', $widgetCounter + 1); $this->widgetContext->setWidgetIdentifier($widgetIdentifier); }
/** * @test * @author Sebastian Kurfürst <*****@*****.**> */ public function widgetIdentifierCanBeReadAgain() { $this->widgetContext->setWidgetIdentifier('myWidgetIdentifier'); $this->assertEquals('myWidgetIdentifier', $this->widgetContext->getWidgetIdentifier()); }