This might not be enoug:
if (isset($field_settings['handler_settings']['target_bundles'][$vocabulary])) {
Active
3.0
Code