function _field_ui_field_name_exists

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'
FieldOverview::form in drupal/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
Overrides Drupal\field_ui\OverviewBase::form().

File

drupal/core/modules/field_ui/field_ui.admin.inc, line 334
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,
  ));
}