You are here

function hosting_client_platform_access_form in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 client/hosting_client.module \hosting_client_platform_access_form()
  2. 7.3 client/hosting_client.module \hosting_client_platform_access_form()

Page callback for the client platform access form.

1 string reference to 'hosting_client_platform_access_form'
hosting_client_menu in client/hosting_client.module
Implements hook_menu().

File

client/hosting_client.module, line 778

Code

function hosting_client_platform_access_form($form, $form_state, $node) {
  $form = array();
  $clients = isset($node->clients) ? $node->clients : array();
  if (count($clients)) {
    foreach ($clients as $client) {
      $client_node = hosting_get_client($client);
      $form['names'][$client] = array(
        '#type' => 'markup',
        '#value' => l($client_node->title, 'node/' . $client),
      );

      // Remove the label for the checkbox.
      $clients[$client] = '';
    }
  }
  else {

    // No access control on this platform.
    $form['names']['_all'] = array(
      '#type' => 'markup',
      '#value' => 'All clients have access to this platform.',
    );
  }
  $form['clients'] = array(
    '#type' => 'checkboxes',
    '#options' => $clients,
  );
  $form['header'] = array(
    '#type' => 'value',
    '#value' => array(
      array(
        'data' => t('Allowed clients'),
      ),
      array(
        'data' => t('Remove'),
      ),
    ),
  );
  $form['new_client'] = array(
    '#type' => 'textfield',
    '#title' => t('Grant a client access to this platform'),
    '#weight' => 2,
    '#autocomplete_path' => 'hosting_client/autocomplete/client',
    '#description' => t('This field allows you to grant a client access to this platform.
                         Remove all clients from this list to grant all clients access to this platform'),
  );
  $form['#theme'] = 'hosting_client_platform_access_form';
  $form['apply'] = array(
    '#type' => 'submit',
    '#value' => t('Apply'),
    '#access' => user_access('administer clients'),
    '#submit' => array(
      'hosting_client_platform_access_form_submit',
    ),
    '#weight' => 10,
  );
  return $form;
}