You are here

function zoomapi_settings_form in Zoom API 7.2

Same name and namespace in other branches
  1. 7 zoomapi.admin.inc \zoomapi_settings_form()

Settings Form.

1 string reference to 'zoomapi_settings_form'
zoomapi_menu in ./zoomapi.module
Implements hook_menu().

File

./zoomapi.admin.inc, line 11
Page callbacks for Zoom API administrative pages.

Code

function zoomapi_settings_form($form, &$form_state) {
  $api_key = variable_get('zoomapi_key', '');
  $api_secret = variable_get('zoomapi_secret', '');
  $form['zoomapi_create_on_new_user'] = [
    '#title' => t('Create Zoom User for every account'),
    '#description' => t('Create a zoom account for each new user. Note: this is not retroactive.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('zoomapi_create_on_new_user', FALSE),
  ];
  $form['zoomapi_use_account_email'] = [
    '#title' => t('Use Drupal account email addresses'),
    '#description' => t('Check this to use Drupal account email addresses for Zoom user email addresses. Off by default as this can lead to potential issues if that email address is already used on Zoom.'),
    '#type' => 'checkbox',
    '#value' => variable_get('zoomapi_use_account_email', FALSE),
  ];
  $form['zoomapi_user_email_pattern'] = [
    '#title' => t('Zoom user email pattern'),
    '#description' => t('The pattern used to auto generate email addresses for new user accounts when an email is not provided.'),
    '#type' => 'textfield',
    '#default_value' => variable_get('zoomapi_user_email_pattern', ZOOMAPI_USER_EMAIL_PATTERN_DEFAULT),
    '#states' => [
      'visible' => [
        ':input[name="zoomapi_use_account_email"]' => [
          'checked' => FALSE,
        ],
      ],
    ],
  ];
  $form['unsuccessful_recording_downloads'] = [
    '#title' => t('Unsuccessful Recording Downloads'),
    '#description' => t('How to handle unsuccessful meeting recording downloads.'),
    '#type' => 'fieldset',
    '#collapsed' => FALSE,
    '#collapsible' => TRUE,
  ];
  $form['unsuccessful_recording_downloads']['zoomapi_recordings_download_process'] = [
    '#title' => t('Handle Unsuccessful Downloads'),
    '#description' => t('Choose if / how to handle unsuccessful downloads'),
    '#type' => 'select',
    '#options' => [
      'off' => t('Do not handle'),
      'cron' => t('Cron'),
      'queue' => t('Queue'),
    ],
    '#default_value' => variable_get('zoomapi_recordings_download_process', 'cron'),
  ];
  $form['unsuccessful_recording_downloads']['zoomapi_recordings_download_cron_set_size'] = [
    '#title' => t('Max number per run'),
    '#description' => t('To avoid timing out, limit the number of unsuccessful recordings to process at each cron run.'),
    '#type' => 'textfield',
    '#element_validate' => [
      'element_validate_integer_positive',
    ],
    '#default_value' => variable_get('zoomapi_recordings_download_cron_set_size', 10),
    '#states' => [
      'visible' => [
        ':input[name="zoomapi_recordings_download_process"]' => [
          'value' => 'cron',
        ],
      ],
    ],
  ];
  $form['unsuccessful_recording_downloads']['zoomapi_recordings_download_max_attempts'] = [
    '#title' => t('Max Attempts'),
    '#description' => t('How many failed attempts before ignoring.'),
    '#type' => 'textfield',
    '#element_validate' => [
      'element_validate_integer_positive',
    ],
    '#default_value' => variable_get('zoomapi_recordings_download_max_attempts', 3),
    '#states' => [
      'visible' => [
        ':input[name="zoomapi_recordings_download_process"]' => [
          '!value' => 'off',
        ],
      ],
    ],
  ];
  $form['unsuccessful_recording_downloads']['zoomapi_recordings_download_how_far_back'] = [
    '#title' => t('Max Age'),
    '#description' => t('How far back to check for failed recordings. Note: this value is used in strtotime.'),
    '#type' => 'textfield',
    '#default_value' => variable_get('zoomapi_recordings_download_how_far_back', '-30 days'),
    '#states' => [
      'visible' => [
        ':input[name="zoomapi_recordings_download_process"]' => [
          '!value' => 'off',
        ],
      ],
    ],
  ];
  $form['unsuccessful_recording_downloads']['zoomapi_recordings_download_retention_days'] = [
    '#title' => t('Retention Days'),
    '#description' => t('How many days to retain records. Note: Make sure this is greater than Max Age.'),
    '#type' => 'textfield',
    '#element_validate' => [
      'element_validate_integer_positive',
    ],
    '#default_value' => variable_get('zoomapi_recordings_download_retention_days', 60),
  ];
  $form['zoomapi_retain_meeting_index_days'] = [
    '#title' => t('Meeting Index Retention Days'),
    '#description' => t('How many days past meeting time to retain meeting information.'),
    '#type' => 'textfield',
    '#element_validate' => [
      'element_validate_integer_positive',
    ],
    '#default_value' => variable_get('zoomapi_retain_meeting_index_days', 30),
  ];
  $form['zoomapi_retain_webhook_days'] = [
    '#title' => t('Webhook Retention Days'),
    '#description' => t('How many days to retain webhook events.'),
    '#type' => 'textfield',
    '#element_validate' => [
      'element_validate_integer_positive',
    ],
    '#default_value' => variable_get('zoomapi_retain_webhook_days', 30),
  ];
  $form['credentials'] = [
    '#title' => t('Credentials'),
    '#description' => t('Enter or update Zoom account credentials.'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => $api_key && $api_secret,
  ];

  // API Key.
  $form['credentials']['zoomapi_key'] = [
    '#title' => t('Zoom API Key'),
    '#description' => t('https://developer.zoom.us/'),
    '#default_value' => $api_key,
    '#type' => 'textfield',
    '#required' => TRUE,
  ];

  // API Secret.
  $form['credentials']['zoomapi_secret'] = [
    '#title' => t('Zoom API Secret'),
    '#description' => t('https://developer.zoom.us/'),
    '#default_value' => $api_secret,
    '#type' => 'textfield',
    '#required' => TRUE,
  ];
  return system_settings_form($form);
}