[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [FIX] Plugin Tour: update plugin doc and ensure that a multi-step tour functions correctly

"Merci Jacob \(@mercihabam\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68adf76c10c94_2cd72a85027f@gitlab-sidekiq-low-urgency-cpu-bound-v2-6564b7ddc9-sfldz.mail>

Merci Jacob pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki


Commits:
6a629aa6 by Merci Jacob at 2025-08-26T18:05:29+00:00
[FIX] Plugin Tour: update plugin doc and ensure that a multi-step tour functions correctly
---
* number_of_steps should be optional

* [FIX] Plugin Tour: update plugin doc and ensure that a multi-step tour functions correctly

See merge request tikiwiki/tiki!8356


(cherry picked from commit 151109304c6272887e891fce4db646c1d7be2dc5)

e5d8e61a [FIX] Plugin Tour: update plugin doc and ensure that a multi-step tour functions correctly
46d228b3 number_of_steps should be optional

Co-authored-by: Merci Jacob <[email protected]>
- - - - -


1 changed file:

- lib/wiki-plugins/wikiplugin_tour.php


Changes:

=====================================
lib/wiki-plugins/wikiplugin_tour.php
=====================================
@@ -18,8 +18,8 @@ function wikiplugin_tour_info()
         'params' => [
             'element' => [
                 'name' => tra('Element'),
-                'required' => false,
-                'description' => tra('Element to show the popup on; if empty, use the plugin location itself'),
+                'required' => true,
+                'description' => tra('Element to show the popup on. It should be a valid CSS selector.'),
                 'since' => '15.0',
                 'filter' => 'text',
                 'default' => '',
@@ -60,7 +60,7 @@ function wikiplugin_tour_info()
             'tour_id' => [
                 'name' => tra('Tour ID'),
                 'required' => false,
-                'description' => tra('Set a tour ID to be able to only show the tour once. (Set only in the first step.)'),
+                'description' => tra('Set a tour ID to be able to  show the tour only once or use many steps. (This value should be identical for all steps of the same tour.)'),
                 'since' => '15.0',
                 'filter' => 'text',
                 'default' => 'default',
@@ -131,7 +131,7 @@ function wikiplugin_tour_info()
             'number_of_steps' => [
                 'name' => tra('Number of Steps'),
                 'required' => false,
-                'description' => tra('Number of steps in the tour. (Set only in the first step.)'),
+                'description' => tra('Number of steps in the tour. (Required only in the first step.)'),
                 'since' => '27.0',
                 'filter' => 'int',
                 'default' => '',
@@ -227,18 +227,19 @@ function wikiplugin_tour($data, $params)
     $TOUR_STEPS = "tour_steps_{$params['tour_id']}";
     $TOUR_NUMBER_OF_STEPS = "number_of_steps_{$params['tour_id']}";
 
-    $step = array_filter($params);
-    $content = TikiLib::lib('parser')->parse_data($data);
-    $step['content'] = $content;
-    $_SESSION[$TOUR_STEPS] = array_merge($_SESSION[$TOUR_STEPS] ?? [], [$step]);
-
     // first step
     if ($params['number_of_steps']) {
         $_SESSION[$TOUR_NUMBER_OF_STEPS] = $params['number_of_steps'];
         $unique = 'wptour_' . $_SESSION['id'];
         $_SESSION['startButtonId'] = $unique . '_restart';
+        $_SESSION[$TOUR_STEPS] = [];
     }
 
+    $step = array_filter($params);
+    $content = TikiLib::lib('parser')->parse_data($data);
+    $step['content'] = $content;
+    $_SESSION[$TOUR_STEPS] = array_merge($_SESSION[$TOUR_STEPS] ?? [], [$step]);
+
     $html = '';
 
     if ($_SESSION[$TOUR_NUMBER_OF_STEPS] === count($_SESSION[$TOUR_STEPS])) {



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/6a629aa618468d19435e8f2c6aa0ecad200a59cf

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/6a629aa618468d19435e8f2c6aa0ecad200a59cf
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.