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

Returns form array to configure the service options.

Present a form to configure the service options. In this case the maximum and minimum 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
Implements hook_menu().

File

xmlrpc_example/xmlrpc_example.module, line 291
Module file for xmlrpc_example module.

Code

function xmlrpc_example_server_form() {
  $form = array();
  $form['explanation'] = array(
    '#markup' => '<div>' . t('This is the XML-RPC server configuration page.<br />Here you may define the maximum and minimum values for the addition or subtraction exposed services.<br />') . '</div>',
  );
  $form['xmlrpc_example_server_min'] = array(
    '#type' => 'textfield',
    '#title' => t('Enter the minimum value returned by the subtraction or addition methods'),
    '#description' => t('If the result of the operation is lower than this value, a custom XML-RPC error will be returned: 10002.'),
    '#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'),
    '#description' => t('if the result of the operation is bigger than this value, a custom XML-RPC error will be returned: 10001.'),
    '#default_value' => variable_get('xmlrpc_example_server_max', 10),
    '#size' => 5,
    '#required' => TRUE,
  );
  $form['info'] = array(
    '#type' => 'markup',
    '#markup' => '<div>' . t('Use the <a href="!link">XML-RPC Client example form</a> to experiment', array(
      '!link' => url('examples/xmlrpc/client'),
    )) . '</div>',
  );
  if (variable_get('xmlrpc_example_alter_enabled', FALSE)) {
    $form['overridden'] = array(
      '#type' => 'markup',
      '#markup' => '<div><strong>' . t('Just a note of warning: The <a href="!link">alter form</a> has been used to disable the limits, so you may want to turn that off if you do not want it.', array(
        '!link' => url('examples/xmlrpc/alter'),
      )) . '</strong></div>',
    );
  }
  return system_settings_form($form);
}