addBehavior('initWidgets', array('widgetsCategoriesPage', 'initWidgets')); } // Widget function public static function categoriesPageWidgets($widget) { $core = $GLOBALS['core']; $url = $core->url; if (($widget->homeonly == 1 && $url->type !== 'default') || ($widget->homeonly == 2 && $url->type === 'default')) { return; } $class = $divB = $divE = $title = ''; if ($widget->class) { $class = html::escapeHTML($widget->class); } if ( $widget->content_only) { $divB = '
'; $divE = '
'; } if ( $widget->title ) { $title = '

' . html::escapeHTML($widget->title) . '

'; } return $divB . '' . $divE; } public static function initWidgets($widget) { $text = __('Categories page'); $widget->create('CategoriesPage', $text, array('widgetsCategoriesPage', 'categoriesPageWidgets')); $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:'), ''); } }