'Overall layout for visible components
@param components: the components as dict
@param formstyle: the formstyle (falls back to CRUD formstyle)'

def _layout(self, components, formstyle=None):

    if (formstyle is None):
        formstyle = current.response.s3.crud.formstyle
    row = formstyle('test', 'test', 'test', 'test')
    tuple_rows = isinstance(row, tuple)
    inputs = TAG['']()
    for name in ('type', 'is_required', 'description', 'default_answer', 'max', 'min', 'filter', 'reference', 'represent', 'location', 'options', 'multiple'):
        if (name in components):
            (label, widget, input_id) = components[name]
            formrow = formstyle(('%s__row' % input_id), label, widget, '')
            if tuple_rows:
                inputs.append(formrow[0])
                inputs.append(formrow[1])
            else:
                inputs.append(formrow)
    return inputs
