You are here

public static function Updater::getProjectTitle in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Updater/Updater.php \Drupal\Core\Updater\Updater::getProjectTitle()

Returns the project name from a Drupal info file.

Parameters

string $directory: Directory to search for the info file.

Return value

string The title of the project.

Throws

\Drupal\Core\Updater\UpdaterException

3 calls to Updater::getProjectTitle()
UpdateManagerInstall::submitForm in core/modules/update/src/Form/UpdateManagerInstall.php
Form submission handler.
Updater::__construct in core/lib/Drupal/Core/Updater/Updater.php
Constructs a new updater.
UpdaterTest::testGetProjectTitleWithChild in core/modules/system/src/Tests/Extension/UpdaterTest.php
Tests project and child project showing correct title.

File

core/lib/Drupal/Core/Updater/Updater.php, line 178
Contains \Drupal\Core\Updater\Updater.

Class

Updater
Defines the base class for Updaters used in Drupal.

Namespace

Drupal\Core\Updater

Code

public static function getProjectTitle($directory) {
  $info_file = self::findInfoFile($directory);
  $info = \Drupal::service('info_parser')
    ->parse($info_file);
  if (empty($info)) {
    throw new UpdaterException(t('Unable to parse info file: %info_file.', array(
      '%info_file' => $info_file,
    )));
  }
  return $info['name'];
}