composer_deploy.module in Composer Deploy 7
Same filename and directory in other branches
Hook implementations for this module.
File
composer_deploy.moduleView source
<?php
/**
* @file
* Hook implementations for this module.
*/
/**
* Implements hook_system_info_alter().
*/
function composer_deploy_system_info_alter(&$info, $file, $type) {
$handler =& drupal_static(__FUNCTION__);
if (!isset($handler)) {
module_load_include('php', 'composer_deploy', 'includes/ComposerDeployHandler');
$handler = \Drupal\composer_deploy\ComposerDeployHandler::fromVendorDir(variable_get('composer_deploy_vendor_dir', '../vendor'));
}
if (empty($info['version'])) {
$project = basename($file->name, '.info');
$package = $handler
->getPackage($project);
if ($package) {
$info['project'] = $project;
if (isset($package['extra']['drupal']['version'])) {
$info['version'] = $package['extra']['drupal']['version'];
}
if (isset($package['extra']['drupal']['datestamp'])) {
$info['datestamp'] = $package['extra']['drupal']['datestamp'];
}
// Fallback to other composer metadata
if (empty($info['datestamp'])) {
$info['datestamp'] = strtotime($package['time']);
}
if (empty($info['version']) && substr($package['version'], 0, 4) == 'dev-') {
$info['version'] = substr($package['version'], 4) . '-dev';
}
elseif (empty($info['version'])) {
/**
* @todo: Handle mode version constraints.
*/
$info['version'] = 'dev';
}
}
}
}
Functions
Name | Description |
---|---|
composer_deploy_system_info_alter | Implements hook_system_info_alter(). |