[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Plugin Tour: update plugin doc and ensure that a multi-step tour functions correctly
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <68ac61c3bb8cd_2cd6f38738e4@gitlab-sidekiq-low-urgency-cpu-bound-v2-5b4bb8c664-cpnbn.mail> |
Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
15110930 by Merci Jacob at 2025-08-25T13:06:54+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
- - - - -
1 changed file:
- lib/wiki-plugins/wikiplugin_tour.php
Changes:
=====================================
lib/wiki-plugins/wikiplugin_tour.php
=====================================
@@ -21,8 +21,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' => '',
@@ -63,7 +63,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',
@@ -134,7 +134,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' => '',
@@ -230,18 +230,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 (isset($_SESSION[$TOUR_NUMBER_OF_STEPS]) && $_SESSION[$TOUR_NUMBER_OF_STEPS] === count($_SESSION[$TOUR_STEPS])) {
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/151109304c6272887e891fce4db646c1d7be2dc5
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/151109304c6272887e891fce4db646c1d7be2dc5
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