public static function 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

2 calls to Updater::getProjectTitle()
Updater::__construct in drupal/core/lib/Drupal/Core/Updater/Updater.php
Constructs a new updater.
update_manager_install_form_submit in drupal/core/modules/update/update.manager.inc
Form submission handler for update_manager_install_form().

File

drupal/core/lib/Drupal/Core/Updater/Updater.php, line 138
Definition of 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_parse_info_file($info_file);
  if (empty($info)) {
    throw new UpdaterException(t('Unable to parse info file: %info_file.', array(
      '%info_file' => $info_file,
    )));
  }
  if (empty($info['name'])) {
    throw new UpdaterException(t("The info file (%info_file) does not define a 'name' attribute.", array(
      '%info_file' => $info_file,
    )));
  }
  return $info['name'];
}