You are here

public function ConfigSingleImportForm::getQuestion in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config/src/Form/ConfigSingleImportForm.php \Drupal\config\Form\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 193
Contains \Drupal\config\Form\ConfigSingleImportForm.

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;
}