SmartUI Widget Class ========================= This is a basic usage of SmartUI's ```Widget``` class. Note: This is a basic usage of ```SmartUI```'s ```Widget``` class. If you want to know more about the real HTML layout, click [here](widgets.php) ## Setup ```php $sui = new SmartUI; $options = array( "colorbutton" => false, "editbutton" => true, "togglebutton" => true, "deletebutton" => true, "fullscreenbutton" => true, "custombutton" => true, "collapsed" => false, "sortable" => true ); $widget = $sui->create_widget($options); ``` ## Initiate Below are the list of available properties for the class: * ```Widget::class``` - add your custom class to the main widget container ```
``` * ```Widget::id``` - Id of the widget * ```Widget::attr``` - An ```array``` of your own custom attributes * ```Widget::options``` - An ```array``` of widget options * ```Widget::header``` - A ```string```, ```closure``` or ```array([string icon], [{string or array(attr, content, id, class)}] toolbar], [string class], [string id])``` for the widget's header * ```Widget::body``` - A ```string``` or ```array([string editbox], [string content])``` for body. * Valid keys if passed with ```array```: ```string "editbox"```, string ```string "content"``` ## Sample Usage ```php false, "editbutton" => false, "togglebutton" => true, "deletebutton" => true, "fullscreenbutton" => true, "custombutton" => true, "collapsed" => false, "sortable" => true ); $widget = $sui->create_widget(); //you can also set options this way $widget->options = $options; //set a widget property by passing closure /*$widget->attr = function($widget) { return 'data-custom-attr="test" data-some-id="12345"'; };*/ //set a widget property by passing an array //$widget->attr = array("data-custom-attr"=>"test", "data-some-id" => "12345"); //set a widget property by passing string (some properties are required only to have strings) $widget->attr = 'data-custom-attr="test" data-some-id="12345"'; //same as attr example, you can do the same with other widget properties //$widget->header = 'I just want to say that word in <h2>
'); $result = $widget->print_html(true); echo $result; ?> ```