Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Provides auto start and "filter by tip class" query strings to facilitate multipage tours.
Technical pointers when creating tour tips
Query strings
- ?tour- Auto starts the tour on page. eg ?tour=1
- ?tips - Filters down the tips available on the page based based on the provided class. eg ?tips=tip-views-ui-displays
Tour module generates output like (from admin/structure/views/view/frontpage/edit)
<li
class="tip-module-views-ui tip-type-text tip-views-ui-displays odd first" ## Use for ?tips
data-aria-labelledby="tour-tip-views-ui-displays-label"
data-aria-describedby="tour-tip-views-ui-displays-contents"
data-id="views-display-top"
>
<h2 id="tour-tip-views-ui-displays-label" class="tour-tip-label">Displays in this view</h2>
<p id="tour-tip-views-ui-displays-contents" class="tour-tip-body">A view can ... </p>
<div class="tour-progress">1 of 10</div>
</li>
You may use the class classes to filter on tips.
Comment | File | Size | Author |
---|---|---|---|
#58 | interdiff.txt | 652 bytes | nick_schuch |
#58 | tour-multipage-1942576-58.patch | 4.01 KB | nick_schuch |
#55 | tour-multipage-1942576-55.inderdiff.txt | 722 bytes | nick_schuch |
#55 | tour-multipage-1942576-55.patch | 4.65 KB | nick_schuch |
#52 | tour-multipage-1942576-52.interdiff.txt | 1.13 KB | nick_schuch |
Comments
Comment #1
nick_schuch CreditAttribution: nick_schuch commentedHere is a patch that demonstrates that this is definitely achievable. This is purely a proof of concept patch and Im going to look at consolidating the tour_multipage custom module into the core tour module.
Comment #2
nick_schuch CreditAttribution: nick_schuch commentedTo kick off this basic multipage tour just trigger off the tour on the front page.
Comment #3
nick_schuch CreditAttribution: nick_schuch commentedThe following patch allows for multipage tips.
How can we use this patch for multipage?
Tours can leverage this patch and become multipage tour by including links to a url with the query string ?tour=1. To only show tips of a specific type the query string ?tips=tour-module-view-ui (as an example). Can be used.
What is left?
- It looks like overlay wants to run the tour twice (parent and overlay windows)....
Comment #5
nick_schuch CreditAttribution: nick_schuch commentedRerolled after Language patch commit.
Comment #6
nick_schuch CreditAttribution: nick_schuch commentedComment #7
nick_schuch CreditAttribution: nick_schuch commentedThe following patch adds:
1) Fixes js errors when filtered down to no tips.
2) Hides the "Tour" toggle button if no tips are available once filtered.
Comment #8
nick_schuch CreditAttribution: nick_schuch commentedAdding tag for javascript review.
Comment #9
nod_is the setTimout required at all? hve you tried without, Since it's in a behavior already it's already at the
DOMContentLoaded
stage of the page.I wouldn't look to much into the
_removeIrrelevantTourItems
, see #1938032: Simplify tour.js.Looks good otherwise :)
Comment #10
nick_schuch CreditAttribution: nick_schuch commentedThanks nod_!
The timeout was added in because the tips didnt get enough time to position correctly on the page. I have included a screenshot. This is reproducible by removing the timeout.
Also, Ill get the review happening on the simplifying the js issue :)
Comment #11
nick_schuch CreditAttribution: nick_schuch commentedHopefully we can get in the simplify js issue first and reroll this here.
Comment #12
nod_is the same thing happening when overlay is not used?
Comment #13
nick_schuch CreditAttribution: nick_schuch commentedNo. Looks like it's all good outside of overlay.
Comment #14
larowlan#7: tour-multipage-1942576-7.patch queued for re-testing.
Comment #16
larowlanwill need a re-roll against latest HEAD
Missing new line
aren't these already in?
Comment #17
nick_schuch CreditAttribution: nick_schuch commentedCorrect. Will reroll tonight.
Comment #18
nick_schuch CreditAttribution: nick_schuch commentedAll rerolled an ready for review. To test this:
* "admin/structure/views/view/frontpage/edit?tour=1" - Starts the tour on page load (can be a link in tips on other pages).
* "admin/structure/views/view/frontpage/edit?tour=1&tips=tip-views-ui-displays" - Filters down to a single tip (this means multipage tours don't get high jacked by other tours on the page).
Comment #19
Kristen Pol@nick_schuch - don't see an attachment.
Comment #20
nick_schuch CreditAttribution: nick_schuch commentedoh! late nights... thanks Kirsten Pol!
Comment #21
Kristen PolThanks for the patch! I tested and the tour links you provided work. I'm not clear how the multipage tour works though. The links were just for a tour on views. In one case the full tour and the other, just showing one part of the tour. Can you explain how to test the multipage tour feature?
I reviewed the code and it looks fine to me. I don't know what bbq is for but it sounds delicious :)
Comment #22
nick_schuch CreditAttribution: nick_schuch commentedAbsolutely.
Other tips could provide a "Continue the tour" link with a url containing the ?tour=1 query on the end. This will start the tour on that pages load. If I wanted to filter down the tips on the continued page I could include the tips= to filter them down to a specific subset.
Comment #23
Kristen PolAh, gotcha :) So... is it easy to add the "Continue the tour" link? I haven't played with tour yet. We want to make a multilingual tour:
#1940590: META: Write a multipage multilingual tour
and it will be multipage. Multilingual multipage madness! :)
So... I'll mark RTBC since this patch does what you say it does and the code looks okay.
Comment #24
nick_schuch CreditAttribution: nick_schuch commentedThanks for the review Kristen Pol!
The link could be displayed in the body text of the tip. Which could be a sentence at the end explaining "Continue tour here" or body text in the tip could even link to the page and kick off the tour.
Maybe we should arrange a hangout some time? That way we could coordinate tips and the word being done on tour?
Comment #25
tstoecklerI'm not sure the setTimeout() thing has been sufficiently is there anyway to fix the positioning in the overlay without a setTimeout(). IMO it would be a shame to add such ugliness only because of good old overlay... If there's no other way, I can live with it, but I don't have the impression that was really explored. Hence, setting to needs review.
Comment #26
Kristen Pol@nick_schuch - I'm not sure I'll be doing the multilingual tour myself. I'm behind with work-work :/ Though, it sounds fun to do! :)
Comment #27
Kristen PolIt would be great if this one was resolved so the multilingual tours can link to each other:
#1940590: META: Write a multipage multilingual tour
Comment #28
clemens.tolboomPatch needed a re-roll.
I've added some documentation as we now use the query string.
TODOs:
Remove the timeout if possible as mentioned by @tstoeckler in #25
I don't get the ?tips option yet.
This means 'remove all but named classes' thus one has to know all classes on the other page which must be kept. I expected a continue from tip aka jump to tip on the next page.
Comment #29
clemens.tolboomI've adjusted the toolbar tour from #1920468: Write tour integration for the first page after install showing extend and other things to test with. Also attached is #2027469: View UI Tour is not working and had a sandbox update..
This will auto start the next tour.
Comment #30
clemens.tolboomTesting is even more simple by navigate to a tour page with ?tour=1 like
http://drupal.d8/#overlay=admin/structure/views/view/frontpage?tour=1
As this issue has a patch it's a feature request which must go in this week :-/
Comment #31
nick_schuch CreditAttribution: nick_schuch commentedNeeds a javascript expert. Removing myself from task.
Comment #32
Kristen PolAdding some tags.
Comment #33
nick_schuch CreditAttribution: nick_schuch commentedAs discussed with nod_ in IRC. There are issues with the "active" state which breaks positioning of the tips. Have rerolled without the timeout.
Comment #34
nod_the issue is with upstream actually. The toolbar bug is legit but wasn't the reason for the bug like I thought earlier.
Not much we can do at our level it should be taken with upstream.
Comment #35
Kristen PolThanks @nod_ for the review!
Would love for this to get committed soon so the multilingual tours can use asap :)
Comment #36
clemens.tolboomMy question from #28 isn't addressed.
Filtering on class is AFAIK not related to the tips but to the content unless tour.schema.yml tour.tip.attributes has a 'class'. Does it?
I checked tou_ui TipPluginTextExtended but does not see a class attribute. Only data-id and data-class.
Comment #37
nick_schuch CreditAttribution: nick_schuch commentedTips get provided a series of classes in there respective markup. This allows for contrib to have flexibility and could be anything from theming to js behaviours. In our case we can use "?tips" to filter down tips to a specific subset. Out of the following markup provided via "admin/structure/views/view/content/edit":
All these tips will be shown when pressing the "Tour" toggle in the top right of the page.
If I were to add "?tour=1&tips=tip-views-ui-displays" to the url I would only then see one tip (our tip with the tip-views-ui-displays class) and the tour will start immediately.
However that is just an example.
A more practical scenario for this would be if multiple tours where present on a page and I only wanted to show the only the views ui tour. I could provide a link that had "?tour=1&tips=tip-module-views-ui" appended to the end of the url and all the tips above will still show as they have this class required. If another tour was added to this page later down the track this would also ensure only the views ui tour would still be displayed.
Comment #38
nick_schuch CreditAttribution: nick_schuch commentedReverting #30.
Comment #39
clemens.tolboomic ... so these are the tip IDs and not classes.
@nick_schuch: what do you mean with
We certainly need an issue summary update on this.
Comment #40
klonos...
Comment #40.0
klonosUpdated issue summary.
Comment #41
nick_schuch CreditAttribution: nick_schuch commentedIssue summary has been updated.
Comment #42
larowlanre #39
They are classes, not tip ids. Using a tip id means we can only filter to a single tip. Using a class means we can filter to a group.
The class is part of the tip attributes. The tip attributes are parsed into a standard Attributes object which is rendered as html attributes. Any valid html attribute can be used, including (in this case) class. The attributes property is marked as a sequence in the config schema to cover that it contains an array of variable attributes.
Tour module helpfully adds some default classes if none are provided in the yaml and in most cases this will be enough. These default classes include odd/even, first/last, the tip type (eg tip-type-text) and one identifying the module that the tour belongs to (eg tip-module-views-ui).
As articulated by @nick_schuch at #37 filtering by class means that upon arriving at a page with ?tour=1&tips=foo the available tips on the page are filtered down to only those matching the foo class. Consider a general 'introduction to Drupal' tour that might visit several pages within the site but only show an overview tip on each of those pages, using the tips=foo parameter allows for this behaviour. The tour could visit each page in the multi-page tour, show a selection of tips (targeted by the ?tips=foo parameter) from that page and continue to the next page. Without the ?tips=foo parameter, the multipage tour would present all tips on the page.
Comment #43
clemens.tolboom@larowlan thanks for this explanation in #42.
Unfortunately I still don't get it as AFAIK the attribute values are the destination/target for each tips.
Is the issue summary link the one that should work?
- http://drupal.d8/admin/structure/views/view/frontpage/edit?tips=tip-view...
Comment #44
YesCT CreditAttribution: YesCT commentedThis issue was RTBC and passing tests on July 1, the beginning of API freeze.
Comment #45
larowlan@Clemens, I think we are talking about different things, you are talking about the target element (uses data-id or data-class) that the tip describes. I am talking about the markup that wraps the tip that is output in the page (and transformed into a tip by joyride plugin). The attributes allows you to add additional attributes to the output tip, to aid theming/styling etc of a given tip.
Comment #45.0
larowlanProvide instructions on multipage.
Comment #46
clemens.tolboom@larowlan tnx again. I had a hangout with Nick and finally got it :/
I've updated the issue summary with one tip html output. The class is marked now. Other parts like tip direction (top, bottom, etc) and target still needs some description but that's another issue.
Comment #47
alexpottI don't understand how this issue "Demonstrates a multipage tour"... the issue title / summary could do with an update.
I think this should include examples of how
This documentation needs improvement...
Are there boxing matches going on here? The comments could do with being improved here.
Comment #48
nick_schuch CreditAttribution: nick_schuch commentedHere are the documentation changes as per alexpott's review in #47. I have also updated the issue title accordingly.
Comment #49
larowlanShould be automatically. Can we make it a proper sentence while you're at it. When ?tour=1 is present, the tour will start automatically after the page has loaded. Or similar.
'Pass ?tips=class in the url to filter the available tips to the subset which match the given class' perhaps?
I think you mean bar? If not I've got no idea what's going on :)
Can we make this a proper sentence? 'If the query parameter 'tips' is set, remove all tips that don't have the matching class'.
'Remove all tips from the DOM if there is no corresponding page element'?
Feel free to tell me to take a long walk of a short pier.
Comment #50
nick_schuch CreditAttribution: nick_schuch commentedNope, not at all, appreciate the feedback. Will get right on it!
Comment #51
nick_schuch CreditAttribution: nick_schuch commentedHere are the fixed as identified in #49.
Comment #52
nick_schuch CreditAttribution: nick_schuch commentedDam whitespace.
Comment #53
larowlanWe lost this line, I suspect that will mean modal tips will no longer work
Comment #54
larowlangremlins on d.o
Comment #55
nick_schuch CreditAttribution: nick_schuch commentedThanks mate!
Comment #56
larowlanBack to RTBC!
Comment #57
alexpottThe interdiff between 52 and 55 is not correct...
Is this change necessary?
I'm guess not as this is the first time it has appeared in this patch.
Comment #58
nick_schuch CreditAttribution: nick_schuch commentedalexpott++
Your rock!
Comment #59
larowlanThanks @alexpott.
Comment #60
larowlanTagmonster--
Comment #61
alexpottCommitted 102b8e4 and pushed to 8.x. Thanks!
Comment #62
alexpottActually lets update https://drupal.org/node/1921162 with the new functionality.
Comment #63
nick_schuch CreditAttribution: nick_schuch commentedHave updated notice as per suggestion in #62.
Comment #64
nick_schuch CreditAttribution: nick_schuch commentedComment #65
klonos...
Comment #67
xtfer CreditAttribution: xtfer commentedRelated issue:
#2073891: Customise tour loading by URL
Comment #67.0
xtfer CreditAttribution: xtfer commentedAdded html snippet to explain ?tips