diff -u b/modules/field/field.api.php b/modules/field/field.api.php --- b/modules/field/field.api.php +++ b/modules/field/field.api.php @@ -281,9 +281,9 @@ /** * Allow modules to alter the schema for a field. * - * @param $schema + * @param array $schema * The schema definition as returned by hook_field_schema(). - * @param $field + * @param array $field * The field definition. * * @see field_retrieve_schema() diff -u b/modules/field/field.crud.inc b/modules/field/field.crud.inc --- b/modules/field/field.crud.inc +++ b/modules/field/field.crud.inc @@ -23,13 +23,15 @@ /** * Retrieves the schema for a field. * - * @param $field + * @param array $field * The field array to get the schema definition against. - * @return + * @return array * The field schema definition array. */ function field_retrieve_schema($field) { - module_load_install($field['module']); + // Make sure the installation API is available. + include_once DRUPAL_ROOT . '/includes/install.inc'; + module_load_all_includes('install'); $schema = (array) module_invoke($field['module'], 'field_schema', $field); $schema += array('columns' => array(), 'indexes' => array(), 'foreign keys' => array()); // Give other modules a chance to alter this definition. diff -u b/modules/field/tests/field_test_schema_alter.module b/modules/field/tests/field_test_schema_alter.module --- b/modules/field/tests/field_test_schema_alter.module +++ b/modules/field/tests/field_test_schema_alter.module @@ -2,22 +1,0 @@ - -/** - * @file - * Helper module for the Field API schema alter tests. - */ - -/** - * Implements hook_field_schema_alter(). - */ -function field_test_schema_alter_field_schema_alter(&$schema, $field) { - if ($field['type'] == 'test_field') { - // Alter the field type. - $schema['columns']['value']['type'] = 'float'; - // Add an additional column of data. - $schema['columns']['additional_column'] = array( - 'description' => "Additional column added to image field table.", - 'type' => 'varchar', - 'length' => 128, - 'not null' => FALSE, - ); - } -} only in patch2: unchanged: --- /dev/null +++ b/modules/field/tests/field_test_schema_alter.install @@ -0,0 +1,23 @@ + "Additional column added to image field table.", + 'type' => 'varchar', + 'length' => 128, + 'not null' => FALSE, + ); + } +}