First I want to thank @Lodder and @Irfan for the below code which helped out a lot. The code below will create a button that launches a native Joomla Bootstrap modal.
$modalTitle = 'myModal'; $modalParams = array(); $modalParams['title'] = 'Modal title'; $modalParams['height'] = '100%'; $modalParams['width'] = '100%'; $modalBody = '<p>Modal main text line 2</p>'; $modalBody .= '<p>Modal main text line 2</p>'; $html = '<a href="#modal-' . $modalTitle.'" data-toggle="modal" class="btn">Launch modal</a>'; echo $html .= JHtml::_('bootstrap.renderModal', 'modal-' . $modalTitle, $modalParams, $modalBody);
My question is where can I find a complete set of the params that can be used?
So far I figured out with help from others that there are the following parameters. I would like to create a complete list and leave it here for everyone to find.
['title'] // Not to be confused with $modalTitle as this defines the DOM element while ['title'] defines the title a visitor can see. ['height'] // Height of the modal ['width'] // Width of the modal ['url'] // Adds an Iframe inside the modal body this can work together with other modalBody content ['backdrop'] // true or false. Sets the dark background behind the modal ['animation'] // true or false. Allows the animation or not ['closebtn'] // true or false. Show or hide the closebtn ['keyboard'] // true or false. Allows closing the modal with the esc key ['footer'] // Optional markup for the modal footer ['bodyHeight'] // Sets the height of the body ['modalWidth'] // Another way to set the width
I made the question, and I am still doing research so when I find new stuff I add it here.
Tip: In some templates the heights are not being registered. For instance in Isis the admin template there will be a conflict between the
bodyHeight and the default css attached to
.modal-body this will require some custom css to make this work.