1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
<?php
namespace hji\common\utils;
use hji\membership\Membership;
class Modal
{
static public function getModal($atts)
{
$default_atts = array(
'id' => uniqid('hji-modal-'),
'header' => false,
'title' => false,
'close_x' => false,
'content' => '',
'close_btn' => true,
'save_btn' => true,
'close_btn_text' => 'Close',
'save_btn_text' => 'Save',
'save_btn_id' => uniqid('save-btn-'),
);
$atts = array_merge($default_atts, $atts);
$atts = apply_filters("{$atts['id']}_modal_attributes", $atts);
(is_array($atts)) ? extract($atts) : $content = $atts;
ob_start();
include(Membership::$dir . '/common/views/modal.phtml');
$modal = ob_get_contents();
ob_end_clean();
return $modal;
}
}