[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Sections: An alternative fix for body category classes regression
"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]> Thu, 09 Jul 2026 10:40:22 +0000
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a4f7a9645087_3819ba1833112@gitlab-sidekiq-low-urgency-cpu-bound-v2-7b7dfc5865-ntn7k.mail> |
Jonny Bradley pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
5a8df819 by Jonny Bradley at 2026-07-09T10:23:08+00:00
[FIX] Sections: An alternative fix for body category classes regression
---
* [FIX] sections: An alternative fix for yet another Sections regression to address categories not being added to the `body` tag classes feature.
Reverts !10425, hope that's ok @bsfez?
See merge request tikiwiki/tiki!10673
- - - - -
2 changed files:
- lib/core/Sections.php
- lib/setup/categories.php
Changes:
=====================================
lib/core/Sections.php
=====================================
@@ -411,22 +411,5 @@ class Sections
];
}
}
-
- // Fallback: resolve a plain wiki page from the request when no other
- // context is available (e.g. when called before tiki-index.php sets
- // $cat_type/$cat_objid). The page request var may be a slug.
- if (! empty($request['page'])) {
- $pageName = $request['page'];
- if ($prefs['wiki_url_scheme'] !== 'urlencode') {
- $resolved = TikiLib::lib('wiki')->get_page_by_slug($pageName);
- if (! empty($resolved)) {
- $pageName = $resolved;
- }
- }
- return [
- 'type' => 'wiki page',
- 'object' => $pageName,
- ];
- }
}
}
=====================================
lib/setup/categories.php
=====================================
@@ -10,23 +10,26 @@ if (basename($_SERVER['SCRIPT_NAME']) === basename(__FILE__)) {
die('This script may only be included.');
}
+global $prefs;
if ($prefs['feature_categories'] == 'y' && $prefs['categories_used_in_tpl'] == 'y') {
- $categlib = TikiLib::lib('categ');
+ Sections::onSectionChange(function ($section) {
- $objectCategoryIds = [];
- $objectCategoryIdsNoJail = [];
+ $objectCategoryIds = [];
+ $objectCategoryIdsNoJail = [];
- $currentObject = Sections::currentObject();
- if ($currentObject) {
- $objectCategoryIds = $categlib->get_object_categories($currentObject['type'], $currentObject['object']);
- $objectCategoryIdsNoJail = $categlib->get_object_categories(
- $currentObject['type'],
- $currentObject['object'],
- -1,
- false
- );
- }
+ $currentObject = Sections::currentObject();
+ if ($currentObject) {
+ $categlib = TikiLib::lib('categ');
+ $objectCategoryIds = $categlib->get_object_categories($currentObject['type'], $currentObject['object']);
+ $objectCategoryIdsNoJail = $categlib->get_object_categories(
+ $currentObject['type'],
+ $currentObject['object'],
+ -1,
+ false
+ );
+ }
- $smarty->assign_by_ref('objectCategoryIds', $objectCategoryIds);
- // use in smarty {if isset($objectCategoryIds) and in_array(54, $objectCategoryIds)} My stuff ..{/if}
+ TikiLib::lib('smarty')->assign_by_ref('objectCategoryIds', $objectCategoryIds);
+ // use in smarty {if isset($objectCategoryIds) and in_array(54, $objectCategoryIds)} My stuff ..{/if}
+ });
}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5a8df819a32f6d59b627cc056dd0f66f9b5d9b30
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5a8df819a32f6d59b627cc056dd0f66f9b5d9b30
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs