You are here

class Notifications_Content_Subscription in Notifications 7

Generic content subscription Thread subscription

Hierarchy

Expanded class hierarchy of Notifications_Content_Subscription

1 string reference to 'Notifications_Content_Subscription'
notifications_content_notifications in notifications_content/notifications_content.module
Implementation of hook_notifications()

File

notifications_content/notifications_content.inc, line 10
Drupal Notifications Framework - Default class file

View source
class Notifications_Content_Subscription extends Notifications_Subscription_Simple {

  /**
   * Set all the fields we can from node
   */
  public function set_node($node) {
    $node_mapping = array(
      'node:nid' => $node->nid,
      'node:type' => $node->type,
      'node:uid' => $node->uid,
    );
    foreach ($node_mapping as $index => $value) {
      if ($field = $this
        ->get_field($index)) {
        $field
          ->set_value($value);
      }
    }
    return $this;
  }

  /**
   * Get name
   */
  function get_name() {
    if (isset($this->name)) {
      return $this->name;
    }
    else {
      $type_name = ($type = $this
        ->get_field('node:type')) ? $type
        ->get_name() : t('Content');
      if ($author = $this
        ->get_field('node:uid')) {
        return t('@type posts by @author', array(
          '@type' => $type_name,
          '@author' => $author
            ->get_name(),
        ));
      }
      else {
        return t('@type posts', array(
          '@type' => $type_name,
        ));
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Notifications_Content_Subscription::get_name function Get name 2
Notifications_Content_Subscription::set_node public function Set all the fields we can from node 1
Notifications_Subscription_Simple::get_field function In this case we can get fields by type or by position