You are here

public static function Notifications_Subscription::filter_fields in Notifications 7

Same name and namespace in other branches
  1. 6.4 includes/notifications_subscription.class.inc \Notifications_Subscription::filter_fields()

Filter out fields that have or don't have a value set

Parameters

$fields: Array of field objects to be filtered

$filter: If TRUE will return fields with value set. If FALSE, fields with value not set

2 calls to Notifications_Subscription::filter_fields()
Notifications_Subscription::get_fields in ./notifications.subscription.inc
Get fields as array of field objects
Notifications_Subscription::type_fields in ./notifications.subscription.inc
Get subscription type fields as array of field objects

File

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

Class

Notifications_Subscription
Common base for subscription type and subscription instance

Code

public static function filter_fields($fields, $filter = NULL) {
  if (isset($filter)) {
    foreach ($fields as $key => $field) {
      if ($filter && !isset($field->value) || !$filter && isset($field->value)) {
        unset($fields[$key]);
      }
    }
  }
  return $fields;
}