You are here

public function FieldFormBase::uniqueFieldName in Display Suite 8.2

Same name and namespace in other branches
  1. 8.4 src/Form/FieldFormBase.php \Drupal\ds\Form\FieldFormBase::uniqueFieldName()
  2. 8.3 src/Form/FieldFormBase.php \Drupal\ds\Form\FieldFormBase::uniqueFieldName()

Returns whether a field machine name is unique.

File

src/Form/FieldFormBase.php, line 224

Class

FieldFormBase
Base form for fields.

Namespace

Drupal\ds\Form

Code

public function uniqueFieldName($name) {
  $value = strtr($name, array(
    '-' => '_',
  ));
  $config = $this
    ->configFactory()
    ->get('ds.field.' . $value);
  if ($config
    ->get()) {
    return TRUE;
  }
  return FALSE;
}