function ConfigSingleImportForm::getQuestion

Same name in other branches
  1. 8.9.x core/modules/config/src/Form/ConfigSingleImportForm.php \Drupal\config\Form\ConfigSingleImportForm::getQuestion()
  2. 10 core/modules/config/src/Form/ConfigSingleImportForm.php \Drupal\config\Form\ConfigSingleImportForm::getQuestion()
  3. 11.x core/modules/config/src/Form/ConfigSingleImportForm.php \Drupal\config\Form\ConfigSingleImportForm::getQuestion()

Overrides ConfirmFormInterface::getQuestion

File

core/modules/config/src/Form/ConfigSingleImportForm.php, line 221

Class

ConfigSingleImportForm
Provides a form for importing a single configuration file.

Namespace

Drupal\config\Form

Code

public function getQuestion() {
    if ($this->data['config_type'] === 'system.simple') {
        $name = $this->data['config_name'];
        $type = $this->t('simple configuration');
    }
    else {
        $definition = $this->entityTypeManager
            ->getDefinition($this->data['config_type']);
        $name = $this->data['import'][$definition->getKey('id')];
        $type = $definition->getSingularLabel();
    }
    $args = [
        '%name' => $name,
        '@type' => strtolower($type),
    ];
    if ($this->configExists) {
        $question = $this->t('Are you sure you want to update the %name @type?', $args);
    }
    else {
        $question = $this->t('Are you sure you want to create a new %name @type?', $args);
    }
    return $question;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.