You are here

function hook_opigno_scorm_sco_cmi_get_alter in Opigno 7

Implements hook_opigno_scorm_cmi_get_alter().

This hook allows modules to alter CMI data that is about to be sent back to the SCO.

Parameters

mixed $value: The data that will be returned. Can be NULL if not previously persisted in the database.

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_get_alter()
opigno_scorm_sco_cmi_get in modules/scorm/opigno_scorm.module
Get a CMI data value for the given SCO.

File

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

Code

function hook_opigno_scorm_sco_cmi_get_alter(&$value, $cmi_key, $context) {
  if ($cmi_key === 'cmi.learner_name') {
    $profile = profile_load($context['uid']);
    $value = "{$profile->first_name} {$profile->last_name}";
  }
}