You are here

function bynder_form in Bynder 7

Callback for /admin/configure/media/bynder.

1 string reference to 'bynder_form'
bynder_menu in ./bynder.module
Implements hook_menu().

File

includes/bynder.admin.inc, line 7

Code

function bynder_form($form, &$form_state) {
  $form['bynder_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Bynder API'),
    '#description' => t('You will first need to apply for an API Developer Key'),
    '#collapsible' => true,
  );
  $form['bynder_settings']['bynder_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Bynder url'),
    '#default_value' => variable_get('bynder_url', ''),
    '#size' => 50,
    '#description' => t('The Bynder url.'),
    '#required' => true,
  );
  $form['bynder_settings']['bynder_oauth_consumer'] = array(
    '#type' => 'textfield',
    '#title' => t('OAuth Consumer Token'),
    '#default_value' => variable_get('bynder_oauth_consumer', ''),
    '#size' => 50,
    '#description' => t('The consumer token to be used by the module to communicate with Bynder.'),
    '#required' => true,
  );
  $form['bynder_settings']['bynder_oauth_consumer_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('OAuth Consumer Secret'),
    '#default_value' => variable_get('bynder_oauth_consumer_secret', ''),
    '#size' => 50,
    '#description' => t('The consumer secret to be used by the module to communicate with Bynder.'),
    '#required' => true,
  );
  $form['bynder_settings']['bynder_oauth_token'] = array(
    '#type' => 'textfield',
    '#title' => t('OAuth Token'),
    '#default_value' => variable_get('bynder_oauth_token', ''),
    '#size' => 50,
    '#description' => t('The token to be used by the module to communicate with Bynder.'),
    '#required' => true,
  );
  $form['bynder_settings']['bynder_oauth_token_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('OAuth Token Secret'),
    '#default_value' => variable_get('bynder_oauth_token_secret', ''),
    '#size' => 50,
    '#description' => t('The token secret to be used by the module to communicate with Bynder.'),
    '#required' => true,
  );
  $form['bynder_settings']['bynder_cdn_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Cloudfront CDN url'),
    '#default_value' => variable_get('bynder_cdn_url', ''),
    '#size' => 50,
    '#description' => t('Optional cloudfront CDN url.'),
    '#required' => false,
  );
  $form['bynder_settings']['bynder_proxy_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Proxy url details'),
    '#default_value' => variable_get('bynder_proxy_url', ''),
    '#size' => 50,
    '#description' => t('Enter the proxy url with port: https://my-proxy:1234'),
    '#required' => false,
  );
  $form['bynder_settings']['bynder_upload_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Bynder upload settings'),
    '#description' => t("Choose if uploads should go directly to the Bynder Asset Bank or through Waiting Room \n            first. Note that if the user doesn't have enough permissions it will do the latter by default."),
  );
  $form['bynder_settings']['bynder_upload_settings']['bynder_upload_method'] = array(
    '#type' => 'select',
    '#title' => t('Bynder upload method'),
    '#options' => array(
      'upload' => 'Direct Upload',
      'wait' => 'Upload for Approval',
    ),
    '#default_value' => variable_get('bynder_upload_method', 'upload'),
  );
  $form['bynder_settings']['bynder_upload_settings']['bynder_brand_selected'] = array(
    '#type' => 'select',
    '#title' => t('Bynder brand'),
    '#options' => variable_get('bynder_brands_list', array()),
    '#default_value' => variable_get('bynder_brand_selected', 0),
    '#description' => t('This is the brand associated to Media Asset uploads'),
  );
  $form['bynder_settings']['bynder_upload_settings']['bynder_brands_list_refresh'] = array(
    '#type' => 'submit',
    '#value' => t('Refresh brands list'),
    '#submit' => [
      'bynder_batch_reload_derivatives',
    ],
  );
  $form['bynder_settings']['bynder_derivatives'] = array(
    '#type' => 'fieldset',
    '#title' => t('Bynder image derivatives'),
    '#description' => t('Bynder provides "mini", "webimage" and "thul" image sizes by default. Custom derivatives can be configured to better suit specific use-cases. Reload of derivatives can be triggered if any derivatives are missing from the list.'),
    'derivatives_list' => array(
      '#theme' => 'item_list',
      '#items' => unserialize(variable_get('bynder_derivatives', '')),
    ),
    'check' => array(
      '#type' => 'submit',
      '#value' => t('Reload derivatives info'),
      '#submit' => [
        'bynder_batch_reload_derivatives',
      ],
    ),
  );
  variable_del('temp_derivatives_settings');
  $form['bynder_settings']['bynder_derivatives']['bynder_custom_derivative'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom derivative name'),
    '#default_value' => variable_get('bynder_custom_derivative', 'drupal_custom'),
    '#size' => 50,
    '#description' => t('Custom derivative name set up in Bynder config, allows cropping and resizing.'),
    '#required' => false,
  );
  $form['#submit'][] = 'bynder_form_submit';
  return system_settings_form($form);
}