_install_get_version_info example

/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function getVersionStringToTest() {
    include_once $this->root . '/core/includes/install.core.inc';
    $version = _install_get_version_info(\Drupal::VERSION);
    return $version['major'] . '.' . $version['minor'] . '.x';
  }

}

  protected $defaultTheme = 'stark';

  /** * Gets the version string to use in the translation file. * * @return string * The version string to test, for example, '8.0.0' or '8.6.x'. */
  protected function getVersionStringToTest() {
    include_once $this->root . '/core/includes/install.core.inc';
    $version = _install_get_version_info(\Drupal::VERSION);
    return $version['major'] . '.0.0';
  }

  /** * {@inheritdoc} */
  protected function installParameters() {
    $parameters = parent::installParameters();
    // Install Drupal in German.     $parameters['parameters']['langcode'] = 'de';
    // Create a po file so we don't attempt to download one from
ENDPO;
    include_once $this->root . '/core/includes/install.core.inc';
    $version = _install_get_version_info(\Drupal::VERSION)['major'] . '.0.0';
    file_put_contents($this->publicFilesDirectory . "/translations/drupal-{$version}.de.po", $contents);
    return $parameters;
  }

}
Home | Imprint | This part of the site doesn't use cookies.