You are here

public function WebformImageSelectImagesForm::buildForm in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_image_select/src/WebformImageSelectImagesForm.php \Drupal\webform_image_select\WebformImageSelectImagesForm::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_image_select/src/WebformImageSelectImagesForm.php, line 49

Class

WebformImageSelectImagesForm
Provides a form to set webform image select images.

Namespace

Drupal\webform_image_select

Code

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

  /** @var \Drupal\webform_image_select\WebformImageSelectImagesInterface $webform_images */
  $webform_images = $this
    ->getEntity();

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