You are here

public static function OpignoTinCanApiStatements::contextSetGrouping in Opigno TinCan API 3.x

Same name and namespace in other branches
  1. 8 src/OpignoTinCanApiStatements.php \Drupal\opigno_tincan_api\OpignoTinCanApiStatements::contextSetGrouping()

Sets context grouping.

8 calls to OpignoTinCanApiStatements::contextSetGrouping()
OpignoTincanLiveMeeting::createAndSendTincanStatementsForMeeting in modules/opigno_tincan_live_meeting/src/EventSubscriber/OpignoTincanLiveMeeting.php
Sends tincan statements for Live meeting.
opigno_tincan_modules_user_module_status_insert in modules/opigno_tincan_modules/opigno_tincan_modules.module
Implements hook_ENTITY_TYPE_insert().
opigno_tincan_modules_user_module_status_presave in modules/opigno_tincan_modules/opigno_tincan_modules.module
Implements hook_ENTITY_TYPE_presave().
_opigno_tincan_activities_create_and_send_statements in modules/opigno_tincan_activities/opigno_tincan_activities.module
The main function for building tincan statement object for opigno activity.
_opigno_tincan_courses_create_and_send_course_statements in modules/opigno_tincan_courses/opigno_tincan_courses.module
Creates and sends course statements.

... See full list

File

src/OpignoTinCanApiStatements.php, line 176

Class

OpignoTinCanApiStatements
Class OpignoTinCanApiStatements.

Namespace

Drupal\opigno_tincan_api

Code

public static function contextSetGrouping(Context &$context, $group_ids, $definition_type = NULL) {

  // _opigno_tincan_api_context_set_grouping.
  $grouping = [];
  foreach ($group_ids as $group_id) {
    $statement_group = [];
    $url = Url::fromRoute('entity.group.canonical', [
      'group' => $group_id,
    ], [
      'absolute' => TRUE,
    ])
      ->toString();
    $statement_group['id'] = $url;
    if (!empty($definition_type)) {
      $statement_group['definition'] = [
        'type' => $definition_type,
      ];
    }
    $grouping[] = $statement_group;
  }
  if (!empty($statement_group)) {
    $context
      ->getContextActivities()
      ->setGrouping($statement_group);
  }
  return $context;
}