You are here

function zoomapi_settings_form in Zoom API 7

Same name and namespace in other branches
  1. 7.2 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.
  $form['zoomapi_key'] = [
    '#title' => t('Zoom API Key'),
    '#description' => 'https://zoom.us/developer/api/credential',
    '#default_value' => variable_get('zoomapi_key', ''),
    '#type' => 'textfield',
    '#required' => TRUE,
  ];

  // API Secret.
  $form['zoomapi_secret'] = [
    '#title' => t('Zoom API Secret'),
    '#description' => 'https://zoom.us/developer/api/credential',
    '#default_value' => variable_get('zoomapi_secret', ''),
    '#type' => 'textfield',
    '#required' => TRUE,
  ];

  // API URL.
  $form['zoomapi_url'] = [
    '#title' => t('Zoom API URL'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#default_value' => variable_get('zoomapi_url', 'api.zoom.us/v1'),
    '#field_prefix' => 'https://',
    '#field_suffix' => '/',
  ];

  // SendRequests enabled.
  $form['zoomapi_sendrequests_enabled'] = [
    '#title' => t('Enable API'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('zoomapi_sendrequests_enabled', TRUE),
    '#description' => t('Uncheck this to disable sending API requests to Zoom. This may be useful for debugging API calls without actually sending the request.'),
  ];

  // Enable webhooks.
  $form['zoomapi_webhooks_enabled'] = [
    '#title' => t('Enable Webhooks'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('zoomapi_webhooks_enabled', 0),
    '#description' => 'https://zoom.github.io/api/?shell#webhooks',
  ];
  $form['zoomapi_webhooks_username'] = [
    '#title' => t('HTTP Basic Auth Username'),
    '#type' => 'textfield',
    '#default_value' => variable_get('zoomapi_webhooks_username', ''),
    '#states' => [
      'visible' => [
        'input[name="zoomapi_webhooks_enabled"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
  ];
  $form['zoomapi_webhooks_password'] = [
    '#title' => t('HTTP Basic Auth Password'),
    '#type' => 'textfield',
    '#default_value' => variable_get('zoomapi_webhooks_password', ''),
    '#states' => [
      'visible' => [
        'input[name="zoomapi_webhooks_enabled"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
  ];
  return system_settings_form($form);
}