You are here

public function Notifications_Subscription::element_operation in Notifications 7

Get operation buttons for form

1 call to Notifications_Subscription::element_operation()
Notifications_Subscription::get_form in ./notifications.subscription.inc
Get form for this subscription

File

./notifications.subscription.inc, line 578
Drupal Notifications Framework - Default class file

Class

Notifications_Subscription
Common base for subscription type and subscription instance

Code

public function element_operation($operation) {
  $elements = array(
    '#type' => 'fieldset',
    '#weight' => 100,
  );
  switch ($operation) {
    case 'view':
      return;

    // no buttons.
    case 'subscribe':
    case 'add':
      $elements['subscribe'] = array(
        '#type' => 'submit',
        '#name' => 'subscribe',
        '#value' => t('Create subscription'),
      );
      break;
    case 'edit':
      $elements['save'] = array(
        '#type' => 'submit',
        '#name' => 'save',
        '#value' => t('Save subscription'),
      );

    // no break
    case 'delete':
    case 'unsubscribe':
      $elements['delete'] = array(
        '#type' => 'submit',
        '#name' => 'delete',
        '#value' => t('Delete subscription'),
      );
      break;
  }
  $elements['cancel'] = array(
    '#type' => 'submit',
    '#name' => 'cancel',
    '#value' => t('Cancel'),
  );
  return $elements;
}