public function ConfigImportConfirmForm::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/ ConfigImportConfirmForm.php, line 79
Class
- ConfigImportConfirmForm
- Defines a confirmation form for importing configuration.
Namespace
Drupal\config_update_ui\FormCode
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 import (as opposed to revert), the configuration item must exist in
// extension storage but not active 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 import the %type config %item from its source configuration?', [
'%type' => $type_label,
'%item' => $this->name,
]);
}