Commit d9a69f91 authored by Ayesh Karunaratne's avatar Ayesh Karunaratne
Browse files

Issue #2479887: Proper usage of hook_regcode_load

parent e593376e
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -29,10 +29,13 @@ function hook_regcode_validate($edit, $account) {


/**
 * Called when a registration code is loaded
 * @param array $code An array of reg codes, indexed by the registration 
 * code ID.
 */
function hook_regcode_load($code) {
  $code->group = 'foo';
function hook_regcode_load(array $code) {
  foreach ($code as $rid => $regcode) {
    $regcode->group = 'foo';
  }
}


+6 −2
Original line number Diff line number Diff line
@@ -373,8 +373,12 @@ function regcode_load_single($id, $conditions = array()) {
    $regcode->tags[$tag->tid] = $tag->name;
  }

  // Allow modules to add properties
  module_invoke_all('regcode_load', $regcode);
  /*
   * Entity loaders expect arrays of objects. entity_load and this function both
   * invoke the hook below.
   */
  $reg_codes = array($regcode->rid => $regcode);
  module_invoke_all('regcode_load', $reg_codes);

  return $regcode;
}