You are here

public function WebformAccessGroupForm::buildForm in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_access/src/WebformAccessGroupForm.php \Drupal\webform_access\WebformAccessGroupForm::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 EntityForm::buildForm

File

modules/webform_access/src/WebformAccessGroupForm.php, line 104

Class

WebformAccessGroupForm
Provides a form to define a webform access group.

Namespace

Drupal\webform_access

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\webform_access\WebformAccessGroupInterface $webform_access_group */
  $webform_access_group = $this
    ->getEntity();

  // Customize title for duplicate and edit operation.
  switch ($this->operation) {
    case 'duplicate':
      $form['#title'] = $this
        ->t("Duplicate '@label' access group", [
        '@label' => $webform_access_group
          ->label(),
      ]);
      break;
    case 'edit':
      $form['#title'] = $webform_access_group
        ->label();
      break;
  }
  return parent::buildForm($form, $form_state);
}