Modal

The modal function is used to display a modal, you can use modals however you want and please.

Structure

showModal($title, $body, $footer, $btn_text, $btn_color, $btn_icon, $btn_size = '')

Parameters

The show modal function accepts 7 parameters that wie wil elaborate below

  • Title- This will be the title shown on the modal

  • Body- This is the modal body, html content can be passed in as well

  • Footer- This is the text to be shown on the footer, html content allowed

  • Button Text- This is the text to be shown on the button to launch the modal

  • Button color- This is the bootstrap color class for the button values can be: primary, danger, success, warning, info

  • Button Icon- This you can pass in a font awesome class for icon to be used on the button

  • Button size- the size class of the button , values can be: btn-sm, btn-md, btn-lg, btn-xl, btn-xs

Example Usage

The modal funtion when called returns an array which contains btn and html, you can then access this and echo them. below is an example

$testmodal=showModal('Test Modal','Some html goes in here','Ayooo','Launch Modal','primary','fas fa-rocket','btn-md');
echo $testmodal['btn'];
echo $testmodal['html'];

The output

Last updated