michael-milette / moodle-filter_filtercodes

FilterCodes filter for Moodle enables content creators to easily customize and personalize course and site content using plain text tags (no HTML). For premium support, contact us at https://www.tngconsulting.ca/contact
https://moodle.org/plugins/filter_filtercodes
GNU General Public License v3.0
32 stars 44 forks source link

Feature Request: filtercode for custom name primary button #165

Closed Brada65 closed 2 years ago

Brada65 commented 3 years ago

It would be great to have filter code for a primary button like "Continue" in the lessons.

Of course option of the custom name of the button will be much better (your idea).

As we already talked it should be like this:

{button https://google.ca}Continue{/button}

Thank you!

michael-milette commented 3 years ago

Hi @Brada65 ,

As requested, I have added the new {button URL}Label{/button} tag. Here are 3 examples:

The last one will create a button called "Dashboard", using the Moodle language strings, with a link to /my in your Moodle site, regardless of where Moodle is installed (root or subdirectory). The result will be (colour may vary depending on your theme): image

This new feature is currently only available in the version of FilterCodes available here on GitHub. This feature will be included in the next release of FilterCodes on Moodle.org around the same time as Moodle 4.0, currently expected in December 2021.

If you would be so kind, I would appreciate it very much if you could test the new {button} tag and let me know whether or not it works for you and meets your needs.

Best regards,

Michael

Brada65 commented 3 years ago

Thank you Michael, on your quick response. Here are result on my local moodles first one is just bare 3.11 with your theme, and filtercodes. buttons

Second one is my 3.9 with Adaptable theme and lot of other plugins, but same result. buttons2

Based on last example "Dashboard" on both platforms, I think it is something in URL that is causing this.

Best regards,

Vladimir

Brada65 commented 3 years ago

One more result from real situation, tag added to discussion forum description to lead to the next lesson page. buttons3

Resulted with this. buttons4

I hope this will be helpful too.

Best regards,

Vladimir

michael-milette commented 3 years ago

Hi @Brada65

Copy the examples into notepad and the copy and paste them into Moodle. Either that or type the text manually. The problem is that Github is turning the plain text into links and then pasting that HTML into Moodle.

Another possibility might be caused by Moodle automatically turning URLs into links. It is a filter in Moodle which is enabled by default in Moodle 3.9+. Other than turning the filter off, I am not sure how to avoid this.

Please let me know which of these is the problem and if you have any suggestions.

Best regards,

Michael

Brada65 commented 3 years ago

You were 100% right. If you unlink url in editor it is showing the button.

unlinked_urls1

It must be manually entered, first try was copy url and paste, the next one is manually entered (look at the button :)).

manually_entered

Great work!

Thank you again,

Vladimir

michael-milette commented 3 years ago

Thanks Vladimir. I should probably include that tip in the documentation :-)

Brada65 commented 3 years ago

It helps also if order of filters are set in a certain way. "Filter Codes" need always to be before "Convert URLs into links and images"

filters_order

It was my pleasure to work with you,

Vladimir

michael-milette commented 3 years ago

Thanks for the tip! I usually have FilterCodes near or at the top of the list of filters.

michael-milette commented 2 years ago

The documentation has been updated to include the suggestion of unlinking the URL in the WYSIWYG editor. See: https://github.com/michael-milette/moodle-filter_filtercodes#why-does-the-button-tag-not-work

This feature will be published on Moodle.org around the time of the release of Moodle 4.0 expected in December 2021.

Thanks again for your help!

Michael