summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-18 09:43:46 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-18 09:43:46 +0100
commita3910a0a7f4e0a102804ca3010f775729648cb7e (patch)
tree1e416a248bf7ce32ab81db31e948ce7134a08b59
parentf5a4594e32c0ba563f88359ca075bc08047a2425 (diff)
downloadblogs-a3910a0a7f4e0a102804ca3010f775729648cb7e.tar.gz
blogs-a3910a0a7f4e0a102804ca3010f775729648cb7e.tar.bz2
blogs-a3910a0a7f4e0a102804ca3010f775729648cb7e.zip
Create service to be used by getServicesSql targeting search results initially
-rwxr-xr-xincludes/bit_setup_inc.php7
-rw-r--r--includes/classes/LibertyBlogService.php18
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` ) ",
+ ];
+}