-
Steps to reproduce the issueThis question arises from a Forum discussion about using Bootstrap modal and carousel 'components' within an article. The user said:
That does not work in Joomla 4 because the javascript for those components is not loaded and I don't see an obvious way to provoke loading. A plugin might be needed - but what trigger to uee? Test: go to https://getbootstrap.com/docs/5.0/components/modal/#live-demo and copy the code there into an article. Click the button in the front end. Expected resultModal opens Actual resultModal does not open. System information (as much as possible)Additional comments |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 10 replies
-
Add That will load the whole JS. 14 files or so. Juhuu! Use Use Or use the new WebAsset Manager codes. The methods above are a shortcut for that. Or short: Nothing has changed. If you want Bootstrap you have to load it somewhere. In Joomla 3 nearly everthing needed Boostrap. So it nearly always loaded somehow somewhere Bootstrap. Any extension has to fire the according lines if it needs that JavaScript like it always was to go sure that the files will be loaded in the template. You can't rely on that in J4. Cassiopaia isn't a Bootstrap template per se even if it uses many parts from Bootstrap SCSS/css. But you find a line |
Beta Was this translation helpful? Give feedback.
-
The question in issue(!) not forum was: A non PHP coder wants to test HTML snippets from Bpootstrap. So my answer was completely correct and not bad. You can afterwards work with the data-bs-* attributes in HTML and all is fine. But an extension developer should use the professor lines.
A simple solution could be.
BTW: In many cases you don't need this extra Joomla 4 configuration (JS) because HTML and data-bs-* attributes are sufficient if you use the according bootstrap CSS. But I don't know if Joomla 4 has castrated BS JS somehow too make it more complicated than it must be ;-) In other words: Bootstrap finds it's dropdown allown and doesn't need asdditional JS selector configuration shit for that. |
Beta Was this translation helpful? Give feedback.
-
I spent most of today putting together a tutorial which includes the documentation provided by @dgrammatiko and suggests a solution along the lines outlined by @ReLater, which I have only just read. There are some problems, or misunderstanding on my part. It is here: https://docs.joomla.org/J4.x:Using_Bootstrap_in_Joomla_4 For example, Offcanvas seems to be absent from Joomla. I am worried that the tutorial might lead novices astray. I will change it if needs be. |
Beta Was this translation helpful? Give feedback.
-
Should be available with the latest nightly build, the PR #32827 just landed a few hours ago (worst case scenario, tomorrow's build). FWIW although the idea of using modules to solve the problem of the article seems doable fundamentally is wrong, you need to use a plugin type content and there either check what interactive component you need or use a combo with some custom fields (a multi-select field can indicate which bootstrap components to load). The custom field approach should be more performant (depending of course on the length of the actual article, etc). My 2c here |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback. I have created a plugin to look for trigger text in the article as an alternative to using a mod_custom override. I also appreciate that it would be best to use a custom field - looking at that next. The mod_custom override still seems valid if users want to put bs component code in a module. Advanced Module Manager was mentioned but I don't know what that is and I don't know how to trigger a plugin from a module. It seems a new type of custom HTML module is required. Tutorial revised to reflect all this so far. |
Beta Was this translation helpful? Give feedback.
-
I created a custom Custom HTML module with check boxes to select which Bootstrap components to load support for. This is really simple for (non-coding) users and can be used in a module position or within an article. And there can be any number of instances for different purposes. I improved and extended the tutorial to provide example usage of all of the Interactive Components. One thing I was uncertain about was whether to use .btn and a tag selectors for Tooltips (and Popovers), or use .hastooltip, or rely on data-bs-toggle="tooltip". Tutorial: https://docs.joomla.org/J4.x:Using_Bootstrap_Components_in_Joomla_4 |
Beta Was this translation helpful? Give feedback.
-
I think the Tutorial is a good enough answer for now. |
Beta Was this translation helpful? Give feedback.
-
@dgrammatiko @ceford Any idea how to load the bootstrap spinners component? |
Beta Was this translation helpful? Give feedback.
I created a custom Custom HTML module with check boxes to select which Bootstrap components to load support for. This is really simple for (non-coding) users and can be used in a module position or within an article. And there can be any number of instances for different purposes.
I improved and extended the tutorial to provide example usage of all of the Interactive Components. One thing I was uncertain about was whether to use .btn and a tag selectors for Tooltips (and Popovers), or use .hastooltip, or rely on data-bs-toggle="tooltip".
Tutorial: https://docs.joomla.org/J4.x:Using_Bootstrap_Components_in_Joomla_4