You are here

function clients_handler_add_page in Web Service Clients 7.3

Page callback for choosing the type of hander to add.

Parameters

$entity_type: The entity type for the handlers.

1 string reference to 'clients_handler_add_page'
ClientsHandlerEntityUIController::hook_menu in includes/clients.ui.inc
Provides definitions for implementing hook_menu().

File

./clients.module, line 556
Clients module provides a UI, storage, and an API for handling connections to remote webservices, including those provided by Services module on other Drupal sites.

Code

function clients_handler_add_page($entity_type) {
  $info = entity_get_info($entity_type);
  $handler_types_callback = $info['admin ui']['types callback'];
  $handler_types = $handler_types_callback();

  // Because the menu item is a local action, we have to set the page title here.
  drupal_set_title(t('Add @type', array(
    '@type' => $info['label'],
  )));
  if (empty($handler_types)) {
    return t('No types are available: you need to enable one or more modules that provide them.');
  }
  $output = '<dl class="handler-type-list">';
  foreach ($handler_types as $type => $handler_info) {
    $output .= '<dt>' . l($handler_info['label'], $info['admin ui']['path'] . '/add/' . $type) . '</dt>';
    if (isset($handler_info['description'])) {
      $output .= '<dd>' . $handler_info['description'] . '</dd>';
    }
  }
  $output .= '</dl>';
  return $output;
}