You are here

public function YamlFormUiElementDeleteForm::getDescription in YAML Form 8

Returns additional text to display as a description.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The form description.

Overrides ConfirmFormBase::getDescription

File

modules/yamlform_ui/src/Form/YamlFormUiElementDeleteForm.php, line 87

Class

YamlFormUiElementDeleteForm
Form for deleting a form element.

Namespace

Drupal\yamlform_ui\Form

Code

public function getDescription() {
  $t_args = [
    '%element' => $this
      ->getElementTitle(),
    '%yamlform' => $this->yamlform
      ->label(),
  ];
  $build = [];
  if ($this->yamlformElement
    ->isContainer($this->element)) {
    $build['warning'] = [
      '#markup' => $this
        ->t('This will immediately delete the %element container and all nested elements within %element from the %yamlform form. This cannot be undone.', $t_args),
    ];
  }
  else {
    $build['warning'] = [
      '#markup' => $this
        ->t('This will immediately delete the %element element from the %yamlform form. This cannot be undone.', $t_args),
    ];
  }
  if ($this->element['#yamlform_children']) {
    $build['elements'] = $this
      ->getDeletedElementsItemList($this->element['#yamlform_children']);
    $build['elements']['#title'] = t('The below nested elements will be also deleted.');
  }
  return $this->renderer
    ->render($build);
}