You are here

function dropbox_client_settings in Dropbox Client 7.4

Same name and namespace in other branches
  1. 7 dropbox_client.module \dropbox_client_settings()
  2. 7.2 dropbox_client.module \dropbox_client_settings()
  3. 7.3 dropbox_client.module \dropbox_client_settings()
1 string reference to 'dropbox_client_settings'
dropbox_client_menu in ./dropbox_client.module
Implements hook_menu().

File

./dropbox_client.module, line 96

Code

function dropbox_client_settings() {
  $form['dropbox_client_key'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('dropbox_client_key', ''),
    '#title' => t('Dropbox client key'),
    '#description' => t('Enter your Dropbox app key. If you do not have an app key, you can create one at <a href="@url" target="_blank">Dropbox developers</a>', array(
      '@url' => 'https://www.dropbox.com/developers/apps/create',
    )),
  );
  $form['dropbox_client_secret'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('dropbox_client_secret', ''),
    '#title' => t('Dropbox client key'),
    '#description' => t('Enter your Dropbox app secret. If you do not have an app secret, you can create one at <a href="@url" target="_blank">Dropbox developers</a>', array(
      '@url' => 'https://www.dropbox.com/developers/apps/create',
    )),
  );
  $form['dropbox_client_account_type'] = array(
    '#states' => array(
      'invisible' => array(
        array(
          'input[name="dropbox_client_key"]' => array(
            'value' => '',
          ),
        ),
        'or',
        array(
          'input[name="dropbox_client_secret"]' => array(
            'value' => '',
          ),
        ),
      ),
    ),
    '#type' => 'select',
    '#title' => t('Selected'),
    '#options' => array(
      0 => t('Select'),
      1 => t('Widesite Dropbox Account'),
      2 => t('Dropbox Account per User'),
    ),
    '#default_value' => variable_get('dropbox_client_account_type', 0),
    '#description' => t('Configure how Dropbox Will be integrated with Drupal. 1) Widesite dropbox account ideal to share files with all users
    2) Enable each user to use his own Dropbox Account '),
  );
  if (variable_get('dropbox_client_account_type', 0) === 1 && (is_string(variable_get('dropbox_client_website_token_secret', 0)) && is_string(variable_get('dropbox_client_website_oauth_token', 0)) && is_string(variable_get('dropbox_client_website_oauth_token_secret', 0)))) {
    $form['dropbox_install_widesite'] = array(
      '#type' => 'item',
      '#markup' => '<span>' . l('Link Dropbox to Website', 'dropbox_client/install') . '</span>',
    );
  }
  else {
    if (variable_get('dropbox_client_key', FALSE) && variable_get('dropbox_client_secret', FALSE) && variable_get('dropbox_client_account_type', 0) == 1) {
      $form['dropbox_install_widesite'] = array(
        '#type' => 'item',
        '#markup' => t('Dropbox Client for Website was configured successfully') . '<span>' . "  " . l('Link Dropbox to Website with another account', 'dropbox_client/install') . '</span>',
      );
    }
  }
  return system_settings_form($form);
}