You are here

public function FieldGroupDeleteForm::buildForm in Field Group 8

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

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfirmFormBase::buildForm

File

src/Form/FieldGroupDeleteForm.php, line 28

Class

FieldGroupDeleteForm
Provides a form for removing a fieldgroup from a bundle.

Namespace

Drupal\field_group\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $field_group_name = NULL, $entity_type_id = NULL, $bundle = NULL, $context = NULL) {
  if ($context == 'form') {
    $mode = $this
      ->getRequest()->attributes
      ->get('form_mode_name');
  }
  else {
    $mode = $this
      ->getRequest()->attributes
      ->get('view_mode_name');
  }
  if (empty($mode)) {
    $mode = 'default';
  }
  $this->fieldGroup = field_group_load_field_group($field_group_name, $entity_type_id, $bundle, $context, $mode);
  return parent::buildForm($form, $form_state);
}