You are here

function Notifications_Object::get_fields in Notifications 7

Get fields for this object type

File

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

Class

Notifications_Object
Wrapper for Drupal objects

Code

function get_fields() {
  if (!isset($this->fields)) {
    $this->fields = array();
    if ($object = $this
      ->get_object()) {

      // As this does an array_merge_recursive() we get grouped field => array(value1, value2..)
      $fields = module_invoke_all('notifications_object_' . $this->type, 'fields', $object);

      // Now we just need to filter out duplicate values
      foreach ($fields as $field) {
        $this->fields[$field
          ->index()] = $field;
      }
    }
  }
  return $this->fields;
}