You are here

function hook_regcode_load in Registration codes 7

Same name and namespace in other branches
  1. 8 regcode.api.php \hook_regcode_load()
  2. 6.2 regcode.api.php \hook_regcode_load()
  3. 7.2 regcode.api.php \hook_regcode_load()

Change the regcode data that is being loaded.

Parameters

array $code: An array of reg codes, indexed by the registration code ID. Each element of the array is a regcode stdClass object. You can change the properties of individual reg codes.

For reasons of backward compatibility and historical reasons, this hook is called from two places.

Entity API module loads the data directly from the database into stdClass objects array, and invokes hook_regcode_load().

In older versions of this module, there was hook already to alter individual regcode values. Since the arguments of the hook implementations are not consistent, reg code module now calls the hook_regcode_load() hook as an array. Note that adding or removing regcodes will work only if the caller expects multiple objects.

If you need to replace and regcode that is being loaded, the array key should not be changed.

Note that tags are not loaded when the hook is invoked by the entity API module.

1 invocation of hook_regcode_load()
regcode_load_single in ./regcode.module
Load a registration code.

File

./regcode.api.php, line 56
Example hook functions for hooks provided by the core regcode module.

Code

function hook_regcode_load(array $code) {
  foreach ($code as $rid => $regcode) {

    /*
     * Do not change $rid or $regcode->rid.
     */

    // Feel free to change other properties.
    $regcode->group = 'foo';
  }
}