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.
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);
$modalBody variable should contain all of your modal content.
Here is a screenshot of the results:
Hope this helps