You are here

function _opigno_tincan_api_set_verb in Opigno TinCan API 7

Parameters

\TinCan\Statement $statement The statement to add the verb:

array(name, id) $verb An array containing the verb name and id (url). Use TinCanVerbs.:

Throws

Exception Throw an Exception if $verb is not conform

3 calls to _opigno_tincan_api_set_verb()
opigno_tincan_api_openbadges_statements_opigno_openbadge_assertion_created in modules/opigno_tincan_api_openbadges_statements/opigno_tincan_api_openbadges_statements.module
Implements hook_opigno_openbadge_assertion_created().
opigno_tincan_api_opigno_statements_opigno_course_passed in modules/opigno_tincan_api_opigno_statements/opigno_tincan_api_opigno_statements.module
_opigno_tincan_api_statement_base_creation in includes/opigno_tincan_api.statements_func.inc
This function will add the current user as the actor, the verb selected in parameter, the object based on the node given in parameter and the timestamp based on the current time.

File

includes/opigno_tincan_api.statements_func.inc, line 35

Code

function _opigno_tincan_api_set_verb(TinCan\Statement &$statement, $verb) {
  if (!_opigno_tincan_api_tincanphp_is_installed()) {
    return false;
  }
  if (empty($verb) || empty($verb['name']) || empty($verb['id'])) {
    throw new Exception('The verb given does not exist');
  }
  $verb = new TinCan\Verb(array(
    'id' => $verb['id'],
    'display' => array(
      'en-US' => $verb['name'],
    ),
  ));
  $statement
    ->setVerb($verb);
}