public static function widget($config = [])
    {
        ob_start();
        ob_implicit_flush(false);
        try {
            /* @var $widget Widget */
            $config['class'] = get_called_class();
            $widget = Reaction::create($config);
            $out = '';
            if ($widget->beforeRun()) {
                $result = $widget->run();
                $out = $widget->afterRun($result);
            }
        } catch (\Exception $e) {
            // close the output buffer opened above if it has not been closed already
            if (ob_get_level() > 0) {
                ob_end_clean();
            }
            throw $e;
        }

        return ob_get_clean() . $out;
    }
public static function widget($config = [])
    {
        ob_start();
        ob_implicit_flush(false);
        try {
            /* @var $widget Widget */
            $config['class'] = get_called_class();
            $widget = Reaction::create($config);
            $out = '';
            if ($widget->beforeRun()) {
                $result = $widget->run();
                $out = $widget->afterRun($result);
            }
        } catch (\Exception $e) {
            // close the output buffer opened above if it has not been closed already
            if (ob_get_level() > 0) {
                ob_end_clean();
            }
            throw $e;
        }

        return ob_get_clean() . $out;
    }
public static function widget ( $ config = [ ] ) { ob_start ( ) ; ob_implicit_flush ( false ) ; try { /* @var $widget Widget */ $ config [ 'class' ] = get_called_class ( ) ; $ widget = Reaction :: create ( $ config ) ; $ out = '' ; if ( $ widget -> beforeRun ( ) ) { $ result = $ widget -> run ( ) ; $ out = $ widget -> afterRun ( $ result ) ; } } catch ( \ Exception $ e ) { // close the output buffer opened above if it has not been closed already if ( ob_get_level ( ) > 0 ) { ob_end_clean ( ) ; } throw $ e ; } return ob_get_clean ( ) . $ out ; }
Creates a widget instance and runs it.
The widget rendering result is returned by this method.
@param array $config name-value pairs that will be used to initialize the object properties
@return string the rendering result of the widget.
Creates a widget instance and runs it . The widget rendering result is returned by this method .