Implements hook_field_widget_properties_ENTITY_TYPE_alter().
function field_test_field_widget_properties_user_alter(&$widget, $context) {
// Always use buttons for the alter_test_options field on user forms.
if ($context['field']['field_name'] == 'alter_test_options') {
$widget['type'] = 'options_buttons';
}
}