You are here

function Notifications_Subscription_List::element_checkboxes in Notifications 7

Build fieldset with subscription options

Was: notifications_object_options_fieldset($subscriptions, $title = FALSE)

2 calls to Notifications_Subscription_List::element_checkboxes()
Notifications_Subscription_List::get_elements in ./notifications.list.inc
Get elements
Notifications_Subscription_List::get_form in ./notifications.list.inc
Get options form

File

./notifications.list.inc, line 379
Drupal Notifications Framework - Default class file

Class

Notifications_Subscription_List
List of subscriptions or subscription types

Code

function element_checkboxes($element = array()) {
  $options = $defaults = array();

  // Note: the options array cannot have a 0 key, but we shouldn't have a 0 subscription either
  // http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#checkboxes
  foreach ($this
    ->get_instances() as $index => $subscription) {
    $options[$index] = $subscription
      ->get_name();
    if ($subscription
      ->is_stored()) {
      $defaults[] = $index;
    }
  }
  return $element + array(
    '#type' => 'checkboxes',
    '#options' => $options,
    '#default_value' => $defaults,
  );
}