You are here

function _hashtags_is_field_exists in Hashtags 8

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

Check if field storage / field exist

Parameters

$entity_type:

$bundle:

$field_name:

Return value

bool|static

6 calls to _hashtags_is_field_exists()
hashtags_entity_presave in ./hashtags.module
Implements hook_entity_presave().
hashtags_form_alter in ./hashtags.module
Implements hook_form_alter().
hashtags_form_field_config_edit_form_alter in ./hashtags.module
Implements hook_form_field_config_edit_form_alter().
hashtags_uninstall in ./hashtags.install
Implements hook_uninstall().
ManagerForm::addField in src/Form/ManagerForm.php

... See full list

File

./hashtags.module, line 217

Code

function _hashtags_is_field_exists($entity_type, $bundle, $field_name) {
  $field_storage = FieldStorageConfig::loadByName($entity_type, $field_name);
  if (empty($field_storage)) {
    return FALSE;
  }
  $field = FieldConfig::loadByName($entity_type, $bundle, $field_name);
  if (empty($field)) {
    return FALSE;
  }
  return $field;
}