ConfigSingleImportForm::getQuestion

public ConfigSingleImportForm::getQuestion()

Returns the question to ask the user.

Return value

string The form question. The page title will be set to this value.

Overrides ConfirmFormInterface::getQuestion

File

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

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->entityManager->getDefinition($this->data['config_type']);
    $name = $this->data['import'][$definition->getKey('id')];
    $type = $definition->getLowercaseLabel();
  }

  $args = array(
    '%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;
}
doc_Drupal
2016-10-29 08:54:28
Comments
Leave a Comment

Please login to continue.