You are here

public function ConfigDeleteConfirmForm::getQuestion in Configuration Update Manager 8

Returns the question to ask the user.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The form question. The page title will be set to this value.

Overrides ConfirmFormInterface::getQuestion

File

config_update_ui/src/Form/ConfigDeleteConfirmForm.php, line 79

Class

ConfigDeleteConfirmForm
Defines a confirmation form for deleting configuration.

Namespace

Drupal\config_update_ui\Form

Code

public function getQuestion() {
  if ($this->type == 'system.simple') {
    $type_label = $this
      ->t('Simple configuration');
  }
  else {
    $definition = $this->configList
      ->getType($this->type);
    if (!$definition) {

      // Make a 404 error if the type doesn't exist.
      throw new NotFoundHttpException();
    }
    $type_label = $definition
      ->get('label');
  }

  // To delete, the configuration item must exist in active storage. Check
  // that and make a 404 error if not.
  $active = $this->configRevert
    ->getFromActive($this->type, $this->name);
  if (!$active) {
    throw new NotFoundHttpException();
  }
  return $this
    ->t('Are you sure you want to delete the %type config %item?', [
    '%type' => $type_label,
    '%item' => $this->name,
  ]);
}