3

Inside a plugin I need to make a popup window to preview some HTML structure. Can I use JLayout to achieve it or is there a more proper way to do it? If JLayout is the way to do it, also would like to know how can I check if a certain Layout is being used. Thanks.

1 Answer 1

6

You can used Joomla's renderModal function to initiate a Bootstrap modal.

$name = 'myModal';
$html = '<a href="#modal-' . $name.'" data-toggle="modal" class="btn">Launch modal</a>';

$modalParams = array();
$modalParams['title']  = 'Modal title';

$modalBody = '<p>Modal main text line 2</p>';
$modalBody .= '<p>Modal main text line 2</p>';

echo $html .= JHtml::_('bootstrap.renderModal', 'modal-' . $name, $modalParams, $modalBody);

The $modalBody variable should contain all of your modal content.

Here is a screenshot of the results:

enter image description here

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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