You are here

public function MaestroTemplateDeleteForm::getDescription in Maestro 8.2

Same name and namespace in other branches
  1. 3.x src/Form/MaestroTemplateDeleteForm.php \Drupal\maestro\Form\MaestroTemplateDeleteForm::getDescription()

Returns additional text to display as a description.

Return value

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

Overrides EntityConfirmFormBase::getDescription

File

src/Form/MaestroTemplateDeleteForm.php, line 22

Class

MaestroTemplateDeleteForm
Class MaestroTemplateDeleteForm.

Namespace

Drupal\maestro\Form

Code

public function getDescription() {

  // let's see if there's any open processes using this template and tell the user that there's open processes that will be jettisoned.
  $count_warning = '';
  $query = \Drupal::entityQuery('maestro_process')
    ->condition('template_id', $this->entity->id);
  $res = $query
    ->execute();
  $count = count($res);
  if ($count > 1) {
    return $this
      ->t('<strong style="color: red; font-size: 1.2em;">Warning!</strong>  There are %count open processes attached to this Template.
          Deleting this process will remove all associated Maestro data.  This action cannot be undone.', [
      '%count' => $count,
    ]);
  }
  elseif ($count == 1) {
    return $this
      ->t('<strong style="color: red; font-size: 1.2em;">Warning!</strong>  There is %count open process attached to this Template.
          Deleting this process will remove all associated Maestro data.  This action cannot be undone.', [
      '%count' => $count,
    ]);
  }
  return $this
    ->t('This action cannot be undone.');
}