public static function Updater::getProjectTitle

public static Updater::getProjectTitle($directory)

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

File

core/lib/Drupal/Core/Updater/Updater.php, line 173

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Updater!Updater.php/function/Updater::getProjectTitle/8.1.x