For a project that I'm working on I need to add specific units for ingredients quantities.

Instead of doing this in a ugly form alter, I wrote the little patch below that allow other modules to alter the units array via a hook like this :

/**
 * Implements hook_recipe_ing_units_alter.
 * 
 * @param array $units
 */
mymodule_recipe_ing_units_alter(&$units){
 // your units alterations here
}

Comments

jgtrescazes’s picture

StatusFileSize
new323 bytes

here's the patch

dcam’s picture

Version: 7.x-1.3 » 7.x-2.x-dev
Issue summary: View changes
StatusFileSize
new2.49 KB
new2.82 KB

Patch with tests.

The last submitted patch, 2: 1579536-2-tests-only.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 2: 1579536-2.patch, failed testing. View results

  • dcam committed 279e10c on 7.x-2.x
    Issue #1579536 by dcam, jgtrescazes: Allow other modules to alter the...
dcam’s picture

Title: Allow other module altering ingredient units list » Allow other modules to alter the ingredient units list
Version: 7.x-2.x-dev » 7.x-1.x-dev
dcam’s picture

Status: Needs work » Needs review
StatusFileSize
new2.62 KB
new2.95 KB

The last submitted patch, 7: 1579536-7-tests-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • dcam committed 64b5fb5 on 7.x-1.x
    Issue #1579536 by dcam, jgtrescazes: Allow other modules to alter the...
dcam’s picture

Status: Needs review » Fixed

I know it's been a long time, but thanks @jgtrescazes.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.