function commerce_file_requirements in Commerce File 7
Same name and namespace in other branches
- 7.2 commerce_file.install \commerce_file_requirements()
Implements hook_requirements() to check for a private file scheme.
File
- ./
commerce_file.install, line 156 - Install, update and uninstall functions this module.
Code
function commerce_file_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time
$t = get_t();
// Status report
if ($phase == 'runtime') {
$scheme_options = _commerce_file_get_private_stream_wrappers_options();
$requirements['commerce_file_private_schemes'] = array(
'title' => $t('Commerce File'),
);
if (!empty($scheme_options)) {
$requirements['commerce_file_private_schemes'] += array(
'value' => $t('Available schemes: %schemes', array(
'%schemes' => implode(', ', $scheme_options),
)),
);
}
else {
$requirements['commerce_file_private_schemes'] += array(
'severity' => REQUIREMENT_ERROR,
'value' => $t('No available private file schemes.'),
'description' => $t('Commerce file requires a private file scheme. Visit (<a href="@configure">configure</a>) to set your private file path. Optionally, a private scheme other than Drupal\'s may be implemented.', array(
'@configure' => url('admin/config/media/file-system'),
)),
);
}
}
return $requirements;
}