You are here

function clients_flickr_config in Web Service Clients 6

Same name and namespace in other branches
  1. 7 backends/clients_flickr/clients_flickr.module \clients_flickr_config()

Return value

array Form

1 string reference to 'clients_flickr_config'
clients_flickr_menu in backends/clients_flickr/clients_flickr.module
Implementation of hook_menu()

File

backends/clients_flickr/clients_flickr.module, line 68
Flickr plugin for Clients module @author Django Beatty - adub

Code

function clients_flickr_config(&$form_state, $op, $cid = '') {
  $form = array();
  if ($cid) {
    $connection = clients_connection_load((int) $cid);
    $form['cid'] = array(
      '#type' => 'value',
      '#value' => $cid,
    );
  }
  $form['type'] = array(
    '#type' => 'value',
    '#value' => variable_get('clients_flickr_type', 'Flickr'),
  );
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Connection name'),
    '#default_value' => $cid ? $connection->name : '',
    '#size' => 50,
    '#maxlength' => 100,
    '#description' => t('Must be unique'),
    '#required' => TRUE,
  );
  $form['endpoint'] = array(
    '#type' => 'value',
    '#value' => 'http://api.flickr.com/services/rest/',
  );
  $form['configuration'] = array(
    '#type' => 'fieldset',
    '#title' => t('Configuration'),
    '#collapsible' => FALSE,
    '#tree' => TRUE,
  );
  $form['configuration']['api_key'] = array(
    '#type' => 'textfield',
    '#title' => t('API key'),
    '#default_value' => $cid ? $connection->configuration['api_key'] : '',
    '#size' => 50,
    '#maxlength' => 100,
    //    '#description' => t('Domain'),
    '#required' => TRUE,
  );
  $form['configuration']['secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Secret'),
    '#default_value' => $cid ? $connection->configuration['secret'] : '',
    '#size' => 50,
    '#maxlength' => 40,
    '#attributes' => array(
      'autocomplete' => 'off',
    ),
    //    '#description' => t('Key'),
    '#required' => TRUE,
  );
  $form['configuration']['methods_enabled'] = array(
    '#type' => 'textarea',
    '#title' => t('Methods'),
    '#default_value' => $cid ? $connection->configuration['methods_enabled'] : '',
    '#description' => t('List of Flickr methods that you want to enable here. One per line.'),
  );
  if ($op == 'add') {
    $form['buttons']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Add connection'),
    );
    $form['#submit'] = array(
      'clients_flickr_add_submit_handler',
    );
  }
  elseif ($op == 'edit') {
    $form['buttons']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
    $form['#submit'] = array(
      'clients_flickr_edit_submit_handler',
    );
  }
  return $form;
}