addBehavior('initWidgets', ['widgetsCategoriesPage', 'initWidgets']); class widgetsCategoriesPage { public static function initWidgets($w) { $w ->create( 'CategoriesPage', __('Categories Page'), ['widgetsCategoriesPage', 'categoriesPageWidgets'], null, __('Link to categories') ) ->addTitle(__('Categories Page')) ->addHomeOnly() ->addContentOnly() ->addClass() ->addOffline(); } public static function categoriesPageWidgets($w) { if ($w->offline) { return; } if (($w->homeonly == 1 && !dcCore::app()->url->isHome(dcCore::app()->url->type)) || ($w->homeonly == 2 && dcCore::app()->url->isHome(dcCore::app()->url->type))) { return null; } return $w->renderDiv( $w->content_only, 'categories ' . $w->class, '', ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . '
' . ($w->link_title ? html::escapeHTML($w->link_title) : __('All categories')) . '
' ); } }