You are here

protected function FieldManager::createNonExistingFieldName in Scheduled Updates 8

Create an used field name adding the suffix number until an used one is found.

Parameters

$field_name:

$entity_type_id:

Return value

string

2 calls to FieldManager::createNonExistingFieldName()
FieldManager::createNewReferenceField in src/FieldManager.php
Creates a new Entity Reference field that will reference the updates of this type.
FieldManager::getNewFieldName in src/FieldManager.php
Gets the first available field name for a give source field.

File

src/FieldManager.php, line 246
Contains \Drupal\scheduled_updates\FieldManager.

Class

FieldManager
Field Manager for handling fields for Scheduled Updates.

Namespace

Drupal\scheduled_updates

Code

protected function createNonExistingFieldName($field_name, $entity_type_id) {
  $suffix = 0;
  $new_field_name = $field_name;
  while ($this
    ->fieldNameExists($new_field_name, $entity_type_id)) {
    $suffix++;
    $new_field_name = $field_name . '_' . $suffix;
  }
  return $new_field_name;
}