'Entry point for other method handlers to embed this
method as widget
@param r: the S3Request
@param method: the widget method
@param widget_id: the widget ID
@param visible: whether the widget is initially visible
@param attr: controller attributes'

def widget(self, r, method=None, widget_id=None, visible=True, **attr):

    self.settings = current.response.s3.crud
    sqlform = self._config('crud_form')
    self.sqlform = (sqlform if sqlform else S3SQLDefaultForm())
    _attr = Storage(attr)
    _attr['list_id'] = widget_id
    if (method == 'datatable'):
        output = self._datatable(r, **_attr)
        if isinstance(output, dict):
            output = DIV(output['items'], _id='table-container')
        return output
    elif (method == 'datalist'):
        output = self._datalist(r, **_attr)
        if (isinstance(output, dict) and ('items' in output)):
            output = DIV(output['items'], _id='list-container')
        return output
    elif (method == 'create'):
        return self._widget_create(r, **_attr)
    else:
        return None
