how to use JHTML::_('behavior.modal') in Joomla?

前端 未结 2 936
醉酒成梦
醉酒成梦 2021-02-11 08:23

I am creating a component,

controllers
    theatercontroller
    facilitycontroller
Models
    theater
    facility
view
    theater
    facility
2条回答
  •  深忆病人
    2021-02-11 09:10

    You can use this function to get a modal button

    static public function getModalButtonObject($name,$text,$link,$width=750,$height=480)
    {
        JHTML::_('behavior.modal', "a.{$name}");  // load the modal behavior for the name u given
            $buttonMap = new JObject();   // create an Jobject which will contain some data, it is similar like stdClass object
            $buttonMap->set('modal', true);
            $buttonMap->set('text', $text );
            $buttonMap->set('name', 'image');
            $buttonMap->set('modalname', $name);
            $buttonMap->set('options', "{handler: 'iframe', size: {x: ".$width.", y: ".$height."}}");
            $buttonMap->set('link', $link);
            return $buttonMap;
    }
    

    And HTML can be written as

    text; ?>
    

提交回复
热议问题