Add attribute-parsing code to widget constructor.