You are here

function clients_flickr_add_validate in Web Service Clients 7

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

Implementation of hook_validate()

File

backends/clients_flickr/clients_flickr.module, line 175
Flickr plugin for Clients module

Code

function clients_flickr_add_validate($form, &$form_state) {
  if (clients_connection_load($form['name']['#value'])) {
    form_set_error('name', 'A service by this name already exists!');
  }
  $connection = new stdClass();
  $connection->name = $form['name']['#value'];
  $connection->endpoint = $form['endpoint']['#value'];
  $connection->api_key = $form['configuration']['api_key']['#value'];
  $connection->secret = $form['configuration']['secret']['#value'];
  $testconnect = clients_connection_flickr::connect($connection);
  if (!is_array($testconnect) || !isset($testconnect['sessid'])) {
    form_set_error('endpoint', "Couldn't connect");
  }
  else {

    // test auth
  }
}