You are here

function Notifications_Subscription::load_objects in Notifications 6.4

Load subscription objects

1 call to Notifications_Subscription::load_objects()
Notifications_Subscription::get_objects in includes/notifications_subscription.class.inc
Get objects

File

includes/notifications_subscription.class.inc, line 760
Drupal Notifications Framework - Default class file

Class

Notifications_Subscription
Message destination class

Code

function load_objects() {
  if (!isset($this->objects)) {
    $this->objects = array();
    foreach ($this
      ->get_fields() as $field) {
      if ($type = notifications_subscription_fields($field->field, 'object_type')) {
        if ($object = notifications_object_load($type, $field->value)) {
          if (!isset($this->objects[$type])) {
            $this->objects[$type] = $object;
          }
          elseif (is_array($this->objects[$type])) {

            // Was an array, just add
            $this->objects[$type][] = $object;
          }
          else {

            // Was single element, make into an array with this new object
            $this->objects[$type] = array(
              $this->objects[$type],
              $object,
            );
          }
        }
        else {

          // Object cannot be loaded, mark as incomplete
          $this->incomplete = TRUE;
        }
      }
    }
  }
  return empty($this->incomplete);
}