You are here

function zoomapi_meeting_create_for_entity in Zoom API 7

Create Meeting for Entity.

Create a meeting for a specific Drupal entity (node). The typical use case is an Event content type (node) or entity.

@todo add meeting tracking for easier start/join url lookups for live meetings.

Parameters

object $account: The Drupal account to act as the host.

object $entity: The entity the meeting is being created for.

string $entity_type: The type (node, user, etc.) of entity.

array $options: Optional array of meeting options.

Return value

array An array of the meeting setup.

1 call to zoomapi_meeting_create_for_entity()
zoomapi_meeting_create_instant_meeting in ./zoomapi.module
Create Instant Meeting for Account.

File

./zoomapi.module, line 482
Main file for the Zoom API module.

Code

function zoomapi_meeting_create_for_entity($account, $entity, $entity_type, array $options = []) {
  if (empty($account->data['zoomapi_user_id'])) {
    return [];
  }
  if (empty($options['type'])) {
    $options['type'] = variable_get('zoomapi_meeting_type_default', ZOOMAPI_MEETING_TYPE_DEFAULT);
  }
  if (empty($options['topic'])) {
    $options['topic'] = zoomapi_meeting_topic_generate_for_entity($account, $entity, $entity_type, $options);
  }
  list($entity_id, $revision_id, $bundle) = entity_extract_ids($entity_type, $entity);
  $zoomapi_meeting = new ZoomAPIMeeting();
  $zoom_meeting = $zoomapi_meeting
    ->create($account->data['zoomapi_user_id'], $options['topic'], $options['type'], $options);
  $zoom_meeting['entity_type'] = $entity_type;
  $zoom_meeting['entity_id'] = $entity_id;
  zoomapi_track_meeting($zoom_meeting);
  return $zoom_meeting;
}