You are here

function hook_opigno_scorm_sco_cmi_set_alter in Opigno 7

Implements hook_opigno_scorm_cmi_set_alter().

This hook allows modules to alter CMI data that is about to be stored. If the module wants to take over the persistence entirely, it can set the value to NULL. Opigno Scorm will then skip the persisting of the data and assume some other module took over.

Parameters

mixed $value: The data to be persisted.

string $cmi_key: The CMI data indentifier for the value.

array $context: Context array, with at least the following keys:

  • uid: The user ID
  • sco_id: The SCO ID.
  • original_value: The original value, in case some module alters it.
1 invocation of hook_opigno_scorm_sco_cmi_set_alter()
opigno_scorm_sco_cmi_set in modules/scorm/opigno_scorm.module
Set a CMI data value for the given SCO.

File

modules/scorm/opigno_scorm.api.php, line 28
This file contains module hooks definitions and documentation.

Code

function hook_opigno_scorm_sco_cmi_set_alter(&$value, $cmi_key, $context) {
  if ($cmi_key === 'cmi.last_location') {

    // Store this somewhere else.
    // db_insert(...)
    // Let Opigno Scorm know we stored this.
    $value = NULL;
  }
}