You are here

function _field_ui_field_name_exists in Drupal 7

Render API callback: Checks if a field machine name is taken.

Parameters

$value: The machine name, not prefixed with 'field_'.

Return value

Whether or not the field machine name is taken.

1 string reference to '_field_ui_field_name_exists'
field_ui_field_overview_form in modules/field_ui/field_ui.admin.inc
Form constructor for the 'Manage fields' form of a bundle.

File

modules/field_ui/field_ui.admin.inc, line 722
Administrative interface for custom field type creation.

Code

function _field_ui_field_name_exists($value) {

  // Prefix with 'field_'.
  $field_name = 'field_' . $value;

  // We need to check inactive fields as well, so we can't use
  // field_info_fields().
  return (bool) field_read_fields(array(
    'field_name' => $field_name,
  ), array(
    'include_inactive' => TRUE,
  ));
}