addBehavior('initWidgets', ['comListeWidget','initWidget']); class comListeWidget { public static function initWidget($w) { $w->create( 'comListe', __('Comments list'), ['comListeWidget','publicWidget'], null, __('Comments list') ) ->addTitle(__('Comments list')) ->setting( 'link_title', __('Link title:'), __('Comments list') ) ->addHomeOnly() ->addContentOnly() ->addClass() ->addOffline(); } public static function publicWidget($w) { if ($w->offline || !$w->checkHomeOnly(dcCore::app()->url->type) || !dcCore::app()->blog->settings->get(basename(__DIR__))->get('enable') ) { return null; } return $w->renderDiv( $w->content_only, 'comliste ' . $w->class, '', ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . sprintf( '
', dcCore::app()->blog->url . dcCore::app()->url->getBase('comListe'), $w->link_title ? html::escapeHTML($w->link_title) : __('Comments list') ) ); } }