diff options
| -rwxr-xr-x | includes/bit_setup_inc.php | 7 | ||||
| -rw-r--r-- | includes/classes/LibertyBlogService.php | 18 |
2 files changed, 24 insertions, 1 deletions
diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php index b9c736f..ee865e5 100755 --- a/includes/bit_setup_inc.php +++ b/includes/bit_setup_inc.php @@ -36,10 +36,15 @@ if( $gBitSystem->isPackageActive( 'blogs' ) ) { ]; $gBitSystem->registerAppMenu( $menuHash ); + require_once BLOGS_PKG_CLASS_PATH.'LibertyBlogService.php'; + $gLibertySystem->registerService( LIBERTY_SERVICE_BLOGS, BLOGS_PKG_NAME, - [ 'module_display_function' => 'blogs_module_display', ], + [ + 'module_display_function' => 'blogs_module_display', + 'search_extra_sql_function' => 'blogs_search_extra_sql', + ], [ 'description' => KernelTools::tra( 'A module display service which helps hook in javascript necessary when using the center module on other pages. This is a temporary fix to address a limitation of the rendering order in BitThemes and only applies to blog content.' ), 'required' => true, diff --git a/includes/classes/LibertyBlogService.php b/includes/classes/LibertyBlogService.php new file mode 100644 index 0000000..3978a0f --- /dev/null +++ b/includes/classes/LibertyBlogService.php @@ -0,0 +1,18 @@ +<?php +/** + * Liberty service functions for the blogs package. + * Functions must be in Bitweaver\Liberty namespace to be resolved by LibertyContent::getServicesSql. + * + * @package blogs + */ +namespace Bitweaver\Liberty; + +function blogs_search_extra_sql( $pObject = null, $pParamHash = null ): array { + return [ + 'select_sql' => ", blog_lc.`title` AS `blog_title`", + 'join_sql' => " LEFT JOIN `" . BIT_DB_PREFIX . "blogs_posts_map` bpm" + . " ON ( bpm.`post_content_id` = lc.`content_id` AND lc.`content_type_guid` = 'bitblogpost' )" + . " LEFT JOIN `" . BIT_DB_PREFIX . "liberty_content` blog_lc" + . " ON ( blog_lc.`content_id` = bpm.`blog_content_id` ) ", + ]; +} |
