You are here

abstract class Notifications_Entity in Notifications 7

Base class for all Notifications entities

Hierarchy

Expanded class hierarchy of Notifications_Entity

File

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

View source
abstract class Notifications_Entity {
  protected $type;

  /**
   * Constructor
   */
  public function __construct($template = NULL) {
    if ($template) {
      $properties = (array) $template;
      foreach ($properties as $key => $value) {
        $this->{$key} = $value;
      }
    }
  }

  /**
   * Get object title
   */
  public abstract function get_title();

  /**
   * Get object name
   */
  public abstract function get_name();

  /**
   * Build from db object or template
   */
  public static function build_object($object) {
    return new Notifications_Entity($object);
  }

  /**
   * User access function
   */
  public abstract function user_access($account, $op = 'view');

  /**
   * Get information from notifications hooks
   */
  public static function type_info($type = NULL, $property = NULL, $default = NULL) {

    // Creating static abstract functions produces warnings.
  }

  /**
   * Get information for specific instance.
   *
   * This is useful for properties that can be overridden with alter hooks
   */
  public function get_info($property = NULL, $default = NULL) {
    return $this
      ->type_info($this->type, $property, $default);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Notifications_Entity::$type protected property 2
Notifications_Entity::build_object public static function Build from db object or template 2
Notifications_Entity::get_info public function Get information for specific instance.
Notifications_Entity::get_name abstract public function Get object name 2
Notifications_Entity::get_title abstract public function Get object title 2
Notifications_Entity::type_info public static function Get information from notifications hooks 2
Notifications_Entity::user_access abstract public function User access function 2
Notifications_Entity::__construct public function Constructor 1