You are here

function _hashtags_is_field_exists in Hashtags 7

Same name and namespace in other branches
  1. 8 hashtags.module \_hashtags_is_field_exists()

Check if field_hashtags field exists for passed entity

Parameters

object $entity :

string $entity_type :

Return value

boolean

5 calls to _hashtags_is_field_exists()
hashtags_comment_insert in ./hashtags.module
Implements hook_comment_insert().
hashtags_comment_presave in ./hashtags.module
Implements hook_comment_presave().
hashtags_entity_insert in ./hashtags.module
Implementation of hook_entity_insert().
hashtags_entity_presave in ./hashtags.module
Implementation of hook_entity_presave().
hashtags_form_field_ui_field_edit_form_alter in ./hashtags.module
Implementation of hook_form_field_ui_field_edit_form_alter().

File

./hashtags.module, line 463

Code

function _hashtags_is_field_exists($field_name, $entity_type, $bundle = '') {

  // some entities doesn't have type property
  if (empty($bundle)) {
    $field_names = field_info_instances($entity_type);
  }
  else {
    $field_names = field_info_instances($entity_type, $bundle);
  }

  // entity doesn't have field_hashtags
  // field attached
  return isset($field_names[$field_name]);
}