inject_bs_modal()
public function inject_bs_modal( array $args )
This method builds the markup for a Bootstrap 5 modal and injects it into the class $modal property. Arguments are passed as an array.
#
Arguments$args
(array) (optional) Parameters used to build the modal.'id'
(string) (optional) The CSS ID for the modal. Defaults to 'bsModal'
Default: 'bsModal''title'
(string) (optional) The title of the modal, displayed in the modal header. This should be included for accessibility purposes. Default: '''hide_title'
(bool) (optional) Whether the header title should be visible. If set to true, the visually-hidden CSS class will be added to the h5 title tag in the modal's header.
Default: false'content'
(string) (optional) Content to display in the body of the modal. This can be anything from a string containing a paragraph of text to one with complex grid markup.
Default: '''prefiltered'
(bool) (optional) Whether the content being passed has allready been passed through WordPress' the_content filter. If true, passed content is used as is. If false, passed content is processed with the 'the_content' filter.
Default: false'size'
(string) (optional) The size postfix to use for the modal, if the default size is not sufficient. Possible values: sm|lg|xl
Default: '''scrollable'
(bool) (optional) Whether or not content in the modal's body should be scrollable.
Default: false'hide_header'
(bool) (optional) Whether the modal header should be visible. If set to true, the visually-hidden CSS class will be added to the modal header div (.modal-header).
Default: false'prepend_header'
(string) (optional) Any markup or content to add to the beginning of the modal's header (just after the.modal-header
div)
Default: '''append_header'
(string) (optional) Any markup or content to add to the end of the modal's header (just before the.modal-header
's closing tag)
Default: '''prepend_body'
(string) (optional) Any markup or content to add to the beginning of the modal's body (just after the.modal-body
div)
Default: '''append_body'
(string) (optional) Any markup or content to add to the end of the modal's body (just before the.modal-body
's closing tag)
Default: '''return'
(bool) (optional) If set to true, the markup for the modal will be returned. If false, the markup will be added to the layout class' $modals property.
Default: false
#
ExampleThe following code...
Would add the following HTML to the class $modal property, which is included in returned layout HTML to the frontend...
#
Notes- Added in v1.1.4