addBehavior('initWidgets', array('widgetsCategoriesPage', 'initWidgets')); } // Widget function public static function categoriesPageWidgets($widget) { $core = $GLOBALS['core']; $url = $core->url; if ($widget->offline) return; if (($widget->homeonly == 1 && $url->type !== 'default') || ($widget->homeonly == 2 && $url->type === 'default')) { return; } $res = ($widget->title ? $widget->renderTitle(html::escapeHTML($widget->title)) : ''). '
'. ($widget->link_title ? html::escapeHTML($widget->link_title) : __('All categories')). '
'; return $widget->renderDiv($widget->content_only,'categories '.$widget->class,'',$res); } public static function initWidgets($widget) { $text = __('Categories Page'); $widget->create('CategoriesPage', __('CategoriesPage'), array('widgetsCategoriesPage', 'categoriesPageWidgets'), null, __('Link to categories')); $categoriesPage = $widget->CategoriesPage; $categoriesPage->setting('title', __('Title:'), $text, 'text'); $categoriesPage->setting('homeonly', __('Display on:'), 0, 'combo', array( __('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2 ) ); $categoriesPage->setting('content_only', __('Content only'), 0, 'check'); $categoriesPage->setting('class', __('CSS class:'), ''); $categoriesPage->setting('offline',__('Offline'),0,'check'); } }