You are here

function Notifications_Subscription_Table::field_operations in Notifications 7

Field operations

1 call to Notifications_Subscription_Table::field_operations()
Notifications_Subscription_Table::subscription_fields in ./notifications.list.inc
Fill in fields for a subscription

File

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

Class

Notifications_Subscription_Table
Loadable collection of subscriptions for tablesel ect

Code

function field_operations($subs) {
  $destination = drupal_get_destination();

  // Build a list of all the accessible operations for the current subscription.
  $operations = array();
  $operations['edit'] = array(
    'title' => t('edit'),
    'href' => $this->base_path . '/' . $subs->sid . '/edit',
    'query' => $destination,
  );
  $operations['delete'] = array(
    'title' => t('delete'),
    'href' => $this->base_path . '/' . $subs->sid . '/delete',
    'query' => $destination,
  );
  if (count($operations) > 1) {

    // Render an unordered list of operations links.
    return array(
      'data' => array(
        '#theme' => 'links',
        '#links' => $operations,
        '#attributes' => array(
          'class' => array(
            'links',
            'inline',
          ),
        ),
      ),
    );
  }
  elseif (!empty($operations)) {

    // Render the first and only operation as a link.
    $link = reset($operations);
    return array(
      'data' => array(
        '#type' => 'link',
        '#title' => $link['title'],
        '#href' => $link['href'],
        '#options' => array(
          'query' => $link['query'],
        ),
      ),
    );
  }
}