2

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.

Sources:

1
  • I realise that you have a partial list and you are seeking a complete list, but it may be better for page layout if you transfer your currently known list of attributes and their usage to a community wiki answer. This way, you give the desired answer a headstart at compiling a full list and other users will have an easier time contributing to the answer that you initiated. If you have questions about this feature, you may ask me here in a comment or on Joomla Meta.
    – mickmackusa
    Jan 29 at 20:49

Your Answer

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

Browse other questions tagged or ask your own question.