blog->settings->addNamespace('postwidgettext'); $core->addBehavior( 'initWidgets', array('postWidgetTextWidget', 'init') ); /** * @ingroup DC_PLUGIN_POSTWIDGETTEXT * @brief postWidgetText - admin and public widget methods. * @since 2.6 */ class postWidgetTextWidget { public static function init($w) { global $core; $w->create( 'postwidgettext', __('Post widget text'), array('postWidgetTextWidget', 'display'), null, __('Add a widget with a text related to an entry') ); $w->postwidgettext->setting( 'title', __('Title:'), __('More about this entry'), 'text' ); $w->postwidgettext->setting( 'excerpt', __('Use excerpt if no content'), 0, 'check' ); $w->postwidgettext->setting( 'show', __('Show widget even if empty'), 0, 'check' ); $w->postwidgettext->setting( 'content_only', __('Content only'), 0, 'check' ); $w->postwidgettext->setting( 'class', __('CSS class:'), '' ); } public static function display($w) { global $core, $_ctx; if (!$core->blog->settings->postwidgettext->postwidgettext_active || !$_ctx->exists('posts') || !$_ctx->posts->post_id ) { return null; } $title = (strlen($w->title) > 0) ? '