MDL-81144 core: Convert add_htmlattributes to hook