function blockreference_requirements in Block reference 7
Implements hook_requirements().
File
- ./
blockreference.install, line 11 - Block reference install file.
Code
function blockreference_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time
$t = get_t();
$drupal_version = '7.14';
if (version_compare(VERSION, $drupal_version) < 0) {
$requirements['drupal'] = array(
'title' => $t('Drupal'),
'value' => VERSION,
'description' => $t('Your Drupal installation is too old. Block reference requires at least Drupal %version.', array(
'%version' => $drupal_version,
)),
'severity' => REQUIREMENT_ERROR,
);
}
if ($phase == 'runtime') {
module_load_include('inc', 'field', 'field.info');
module_load_include('inc', 'field', 'field.crud');
$has_select_sort = FALSE;
$instances = field_info_instances();
foreach ($instances as $entity_type) {
foreach ($entity_type as $bundle) {
foreach ($bundle as $instance) {
if ($instance['widget']['type'] == 'blockreference_select_sort') {
$has_select_sort = TRUE;
break 3;
}
}
}
}
if ($has_select_sort) {
$requirements['blockreference'] = array(
'title' => $t('Block reference'),
'description' => $t('Block reference select lists (with drag-and-drop sort) are deprecated. Please use the <a href="!field_collection">Field collection</a> module.', array(
'!field_collection' => 'http://www.drupal.org/project/field_collection',
)),
'severity' => REQUIREMENT_WARNING,
'value' => '',
);
}
}
return $requirements;
}