You are here

function services_admin_keys_form in Services 6

Same name and namespace in other branches
  1. 5 services_admin_keys.inc \services_admin_keys_form()
1 string reference to 'services_admin_keys_form'
services_menu in ./services.module
Implementation of hook_menu().

File

./services_admin_keys.inc, line 43
@author Services Dev Team

Code

function services_admin_keys_form() {
  $kid = arg(4);
  $key = db_fetch_object(db_query("SELECT * FROM {services_keys} WHERE kid = '%s'", $kid));
  $form['kid'] = array(
    '#type' => 'hidden',
    '#default_value' => $key->kid,
  );
  if ($key->kid) {
    $form['key'] = array(
      '#type' => 'markup',
      '#title' => t('Key'),
      '#value' => '<strong>' . t('API Key') . ':</strong> ' . $key->kid,
    );
  }
  $form['title'] = array(
    '#title' => t('Application title'),
    '#type' => 'textfield',
    '#default_value' => $key->title,
    '#description' => t('The title of the application or website using the service.'),
  );
  $form['domain'] = array(
    '#title' => t('Allowed domain'),
    '#type' => 'textfield',
    '#default_value' => $key->domain,
    '#description' => t('External domain allowed to use this key.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => $key->title ? t('Save key') : t('Create key'),
  );
  return $form;
}