You are here

public function ConfigRevertConfirmForm::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/ConfigRevertConfirmForm.php, line 79

Class

ConfigRevertConfirmForm
Defines a confirmation form for reverting 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 revert (as opposed to import), the configuration item must exist in
  // both active storage and extension storage, so check that and make a 404
  // error if not.
  $extension = $this->configRevert
    ->getFromExtension($this->type, $this->name);
  $active = $this->configRevert
    ->getFromActive($this->type, $this->name);
  if (!$extension || !$active) {
    throw new NotFoundHttpException();
  }
  return $this
    ->t('Are you sure you want to revert the %type config %item to its source configuration?', [
    '%type' => $type_label,
    '%item' => $this->name,
  ]);
}