You are here

public function FieldGroupAddForm::groupNameExists in Field Group 8

Same name and namespace in other branches
  1. 8.3 src/Form/FieldGroupAddForm.php \Drupal\field_group\Form\FieldGroupAddForm::groupNameExists()

Checks if a group machine name is taken.

Parameters

string $value: The machine name, not prefixed.

array $element: An array containing the structure of the 'group_name' element.

FormStateInterface $form_state: The current state of the form.

Return value

bool Whether or not the group machine name is taken.

File

src/Form/FieldGroupAddForm.php, line 278

Class

FieldGroupAddForm
Provides a form for adding a fieldgroup to a bundle.

Namespace

Drupal\field_group\Form

Code

public function groupNameExists($value, $element, FormStateInterface $form_state) {

  // Add the prefix.
  $group_name = self::GROUP_PREFIX . $value;
  $entity_type = $form_state
    ->get('entity_type_id');
  $bundle = $form_state
    ->get('bundle');
  $context = $form_state
    ->get('context');
  $mode = $form_state
    ->get('mode');
  return field_group_exists($group_name, $entity_type, $bundle, $context, $mode);
}