You are here

function services_client_event_config in Services Client 7.2

Event common configuration form.

Parameters

EventHandler $event: Event handler that is configured.

See also

EntityHandler::configForm.

1 string reference to 'services_client_event_config'
services_client_ui::configure_page in plugins/export_ui/services_client_ui.class.php
Page callback; Basic configuration page.

File

./services_client.forms.inc, line 11

Code

function services_client_event_config($form, &$form_state, $event) {
  $form_state['event'] = $event;
  if ($_SERVER['REQUEST_METHOD'] == 'GET') {

    // Show warning that configuration isn't saved.
    if ($event
      ->isChanged()) {
      drupal_set_message(t('This event has been changed. To store changes click on "Save" button on this screen.'), 'warning');
    }

    // Show edit lock warning if exists
    if ($lock = $event
      ->getEditLock()) {
      $account = user_load($lock->uid);
      drupal_set_message(t('This event is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to <a href="!break">break this lock</a>.', array(
        '!user' => theme('username', array(
          'account' => $account,
        )),
        '!age' => format_interval(REQUEST_TIME - $lock->updated),
        '!break' => url($event
          ->getUrl('break-lock')),
      )), 'warning');
      $form['actions']['cancel'] = array(
        '#type' => 'submit',
        '#value' => t('Cancel'),
        '#action' => 'cancel',
      );
      return $form;
    }
  }

  // Run config form function
  $event
    ->configForm($form, $form_state);

  // Add actions.
  $form['actions'] = array(
    '#weight' => 300,
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#action' => 'save',
  );
  $form['actions']['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#action' => 'cancel',
  );
  return $form;
}