You are here

public static function Notifications_Subscription::build_object in Notifications 7

Build from db object or template.

Parameters

$subscription: Notifications_Subscription object, or generic object

Return value

Notifications_Subscription Object of the right class of Notifications_Subscription

Overrides Notifications_Entity::build_object

2 calls to Notifications_Subscription::build_object()
notifications_account_subscription_list_form_submit in notifications_account/notifications_account.pages.inc
Submit list of subscriptions
notifications_subscription_build in ./notifications.module
Build subscription object properly

File

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

Class

Notifications_Subscription
Common base for subscription type and subscription instance

Code

public static function build_object($subscription) {
  if (is_object($subscription) && is_a($subscription, 'Notifications_Subscription')) {
    return $subscription;
  }
  else {
    $subscription = (object) $subscription;
    $class = self::type_info($subscription->type, 'class', 'Notifications_Subscription');
    return new $class($subscription);
  }
}