1

I have created a custom backend button (JToolbarHelper::custom()), when a user clicks the button it shows a popup window with some content. How can I do so, not using JToolbarHelper::preview() as this button will do more than just displaying the content. Is there some inbuilt library function to do so?

1

Popup windows are part of core Joomla. What you need to do to activate functionality is:

JHtml::_('behavior.modal','a.popuplink');

"a.popuplink" can be replaced by any jQuery selector. Script used by Joomla is squeezbox. Also 3+ versions of Joomla you can use bootstrap modals, but it will be a little bit mode complicated.


Full example:

anywhere in your view put

<a class="btn popuplink" href="http://joomla.stackexchange.com/posts/17068">Link that opens up popup styled like button</a>
<?php
JHtml::_('behavior.modal','a.popuplink');
?>
| improve this answer | |
  • it would be helpful if you can provide an example too. I am new to joomla and hence a more detailed explanation would be great :) – Nikita Dhiman Jul 6 '16 at 3:02
  • I'd say that it's to simple for explanation, but I've tried and added the example. Really all you need is past the <?php JHtml::_('behavior.modal','a.popuplink'); ?> and all your links (<a> tags) having class "popuplink" would open in popup. – Alexandr Jul 6 '16 at 6:30
  • will try this and ping you again for help :) thanks – Nikita Dhiman Jul 7 '16 at 16:15
  • @NikitaDhiman you're welcome – Alexandr Jul 7 '16 at 16:18
-1

The popup windows are not part of core Joomla. You need some javascript for this, like jQuery or mootools, or a single JavaScript file with the function defined in there.

Since you can't be sure which backend template is used you have to bring your popup code with you.

So: no, there is no inbuild library function (afaik).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.