CRM-14516 allow filtering and clean up media_buttons function