Description of the need
Add hook_field_schema_alter(), as described in https://www.drupal.org/node/691932, which has been merged into Drupal 7 core as of 7.99. See https://www.drupal.org/node/3406312
For the reasons we have hook_schema_alter() - mainly site-specific tweaks, we should allow the same for field storage.
It would make it easier to implement a contrib module (like date_repeat) that would alter core fields (like core date fields).
Proposed solution
Apply this patch: https://www.drupal.org/files/issues/2023-03-16/drupal-field_schema_alter... or similar.
Alternatives that have been considered
hook_schema_alter() can be used too but it requires checking for each table to see if it's of the right field type and also requires also handling field creation and deletion so it's more work than the proposed new hook.
Example implementation
``` /** * Allow modules to alter the schema for a field. * * @param array $schema * The schema definition as returned by hook_field_schema(). * @param array $field * The field definition. * * @see field_retrieve_schema() */ function hook_field_schema_alter(&$schema, $field) { if ($field['type'] == 'image') { // Alter the length of a field. $schema['columns']['alt']['length'] = 2048; // 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, ); // Add an additional index. $schema['indexes']['fid_additional_column'] = array('fid', 'additional_column'); } } ````
Recent comments
In a blog post titled "Github Tips and Tricks for Contrib Maintainers", I'd like to see some of the following topics: When is the README sufficient for documentation? When should...
Github Tips and Tricks for Contrib Maintainers
Thanks Alejandro. That was the clues I needed.
Ubercart - Programmatically add product to cart and straight to Checkout
Have you tried uc_cart_add_item()? You need to provide the nid of the product. Then you can use backdrop_goto('cart/checkout'); to send the user to the checkout screen. uc_cart_add_item...
Ubercart - Programmatically add product to cart and straight to Checkout