How to go to HTML Blocks in User Tour?

Re: How to go to HTML Blocks in User Tour?

by Joost Elshoff -
Number of replies: 2
Picture of Particularly helpful Moodlers Picture of Testers

If there's a unique CSS selector associated with the block, you could use that instead.

You would need to inspect the page and see if there's anything useful there. In the User Tours docs, there is some information on this:

https://docs.moodle.org/33/en/User_tours#Help_with_CSS_selectors

Average of ratings: Useful (1)
In reply to Joost Elshoff

Re: How to go to HTML Blocks in User Tour?

by Karen Holland -
Picture of Core developers Picture of Plugin developers Picture of Testers

As Joost has mentioned, user tour steps can easily use CSS selectors to identify a target like a particular HTML block.

One simple way to create a step per block would be to use the block instance id of the particular HTML block, as it *should* be unique.

You would need to add #instance-xxx-header as the text in the selector field, with xxx being your block's id. This can be viewed from the DOM inspector, and can also be verified by checking the relevant record's id in the <prefix>_block_instances table in your database, if you have access.

Either of these in fact will work as the selector value, the first one gets the header, the second one gets the whole block:

#instance-xxx-header

[data-instanceid="xxx"]

Attachment htmlblock_in_usertour.png
Average of ratings: Useful (2)
In reply to Karen Holland

Re: How to go to HTML Blocks in User Tour?

by MAG II -

Hi - 

I am also trying to figure out how to make User Tours grab an HTML block. I tried using the instance id and it works, but when a new browser is opened / logged in from a different computer then the instance id changes. Thus, the particular HTML block is not highlighted in the User Tour. 


Are there any other ways to demonstrate an HTML block in a User Tour?