diff --git a/media_gallery.info b/media_gallery.info index c21ef79..3b43cc8 100755 --- a/media_gallery.info +++ b/media_gallery.info @@ -8,6 +8,7 @@ dependencies[] = number dependencies[] = media dependencies[] = taxonomy dependencies[] = multiform +dependencies[] = menu files[] = media_gallery.module files[] = media_gallery.admin.inc diff --git a/media_gallery.install b/media_gallery.install index c3d7123..29d719d 100644 --- a/media_gallery.install +++ b/media_gallery.install @@ -112,33 +112,35 @@ function media_gallery_install() { /** * Implements hook_requirements(). */ -function media_gallery_requirements() { +function media_gallery_requirements($phase) { $requirements = array(); $t = get_t(); - $required_fields = _media_gallery_controlled_fields(); - // In addition to the fields we control, we also need the standard field_tags - // that most sites will have gotten from their install profile. - $required_fields['field_tags'] = array('type' => 'taxonomy_term_reference'); - - foreach ($required_fields as $field_name => $field_definition) { - $field = field_info_field($field_name); - // If the field doesn't exist, we will create it on install. - if (!$field) { - continue; - } - // Between Media Gallery beta2 and beta3, field definitions were changed - // from list_number to list_float, to keep up with Drupal core changes. - // list_update_7001() handles the updating of existing fields, but - // update.php checks all requirements prior to running any update function. - if ($field['type'] == 'list_number' && $field_definition['type'] == 'list_float') { - continue; - } - if ($field['type'] != $field_definition['type']) { - $requirements['existing_field_' . $field_name] = array( - 'description' => $t("%field_name already exists and is not of type %type. Installation cannot continue. Please remove this field or change its type.", array('%field_name' => $field_name, '%type' => $field_definition['type'])), - 'severity' => REQUIREMENT_ERROR, - ); + if ($phase == 'runtime') { + $required_fields = _media_gallery_controlled_fields(); + // In addition to the fields we control, we also need the standard field_tags + // that most sites will have gotten from their install profile. + $required_fields['field_tags'] = array('type' => 'taxonomy_term_reference'); + + foreach ($required_fields as $field_name => $field_definition) { + $field = field_info_field($field_name); + // If the field doesn't exist, we will create it on install. + if (!$field) { + continue; + } + // Between Media Gallery beta2 and beta3, field definitions were changed + // from list_number to list_float, to keep up with Drupal core changes. + // list_update_7001() handles the updating of existing fields, but + // update.php checks all requirements prior to running any update function. + if ($field['type'] == 'list_number' && $field_definition['type'] == 'list_float') { + continue; + } + if ($field['type'] != $field_definition['type']) { + $requirements['existing_field_' . $field_name] = array( + 'description' => $t("%field_name already exists and is not of type %type. Installation cannot continue. Please remove this field or change its type.", array('%field_name' => $field_name, '%type' => $field_definition['type'])), + 'severity' => REQUIREMENT_ERROR, + ); + } } } return $requirements;