The widgets ViewHelper fetches Widgets for a given Item.
→ Since BIGACE 3.0
The $item to fetch Widgets for.
The $name of the Widget column. (Default: null → ignore if you are using only one column).
Returns an array of Widget obbjects, see API.
This example shows to load and display widgets in a normal (one column) layout.
<?php /* Widgets: sidebar */ $widgets = $this->widgets($this->MENU); foreach($widgets as $widget) { echo '<h2>' . $widget->getTitle() . '</h2>'; echo $widget->getHtml(); } ?>
This example shows support for multiple widget columns.
<?php /* Widgets: left,right */ echo '<div id="left">'; $widgets = $this->widgets($this->MENU, 'left'); foreach($widgets as $widget) { echo '<h2>' . $widget->getTitle() . '</h2>'; echo $widget->getHtml(); } echo '</div>'; echo '<div id="right">'; $widgets = $this->widgets($this->MENU, 'right'); foreach($widgets as $widget) { echo '<h2>' . $widget->getTitle() . '</h2>'; echo $widget->getHtml(); } echo '</div>'; ?>