def build_widget_attrs(self, extra_attrs=None):
        attrs = {}
        if extra_attrs:
            attrs.update(extra_attrs)

        if (self.required and settings.DJANGOCMS_FORMS_USE_HTML5_REQUIRED
                and 'required' not in attrs and self.field_type not in ('hidden', 'radio', )):
            attrs['required'] = 'required'

        css_classes = {
            '__all__': (),
            'text': ('textinput',),
            'textarea': ('textarea', ),
            'email': ('emailinput', ),
            'number': ('integerfield', ),
            'phone': ('telephoneinput', ),
            'url': ('urlfield', ),
            'checkbox': ('booleanfield',),
            'checkbox_multiple': ('checkboxselectmultiple', ),
            'select': ('choicefield', ),
            'radio': ('radioselect', ),
            'file': ('filefield', ),
            'date': ('dateinput', ),
            'time': ('timeinput', ),
            'password': ('passwordinput', ),
            'hidden': ('hiddeninput', ),
        }

        css_classes.update(settings.DJANGOCMS_FORMS_WIDGET_CSS_CLASSES)

        css_classes = (attrs.get('class', ''), ) + \
            css_classes.get('__all__', ()) + \
            css_classes.get(self.field_type, ())

        attrs['class'] = ' '.join(cls.strip() for cls in css_classes if cls.strip())
        return attrs
Helper function for building an attribute dictionary for form widget.
dataset/ETHPy150Open mishbahr/djangocms-forms/djangocms_forms/models.py/FormField.build_widget_attrs