You are here

function xmlrpc_example_server_form in Examples for Developers 6

Same name and namespace in other branches
  1. 7 xmlrpc_example/xmlrpc_example.module \xmlrpc_example_server_form()

Present a form to configure the xmlrpc service options. In this case the max and min values for any of the operations (add or subtraction).

Related topics

1 string reference to 'xmlrpc_example_server_form'
xmlrpc_example_menu in xmlrpc_example/xmlrpc_example.module
Implementation of hook_menu(). Register all the demonstration forms.

File

xmlrpc_example/xmlrpc_example.module, line 96
This is an example of how to implement an XML-RPC server by registering callbacks to specific methods and how to make xmlrpc calls using the builtin xmlrpc() factory provided by Drupal.

Code

function xmlrpc_example_server_form() {
  $form = array();
  $form['explanation'] = array(
    '#markup' => "<div>" . t("This is the configuration page for the demonstration XMLRPC Server.<br />Here you may define the maximum and minimum values for the add or subtraction exposed services.<br />") . "</div>",
  );
  $form['xmlrpc_example_server_min'] = array(
    '#type' => 'textfield',
    '#title' => t("Enter the minimum value returned by sub or add methods"),
    '#description' => t("An xmlrpc error will result if they sum to more than 10 or the difference is less than 0."),
    '#default_value' => variable_get('xmlrpc_example_server_min', 0),
    '#size' => 5,
    '#required' => TRUE,
  );
  $form['xmlrpc_example_server_max'] = array(
    '#type' => 'textfield',
    '#title' => t("Enter the maximum value returned by sub or add methods"),
    '#default_value' => variable_get('xmlrpc_example_server_max', 10),
    '#size' => 5,
    '#required' => TRUE,
  );
  return system_settings_form($form);
}