select aa.attribute_name from acs_attributes aa, ca_attribute_widget_values cawv, ca_attributes ca where aa.attribute_id = cawv.attribute_id and ca.attribute_id = aa.attribute_id and aa.object_type = :content_type and cawv.enabled_p = 't' and (ca.sitewide_p = 't' or ca.package_id = :package_id) order by aa.sort_order asc