You are here

public function FeedsTermElement::__construct in Feeds 6

Same name and namespace in other branches
  1. 7.2 plugins/FeedsParser.inc \FeedsTermElement::__construct()
  2. 7 plugins/FeedsParser.inc \FeedsTermElement::__construct()

Parameters

$term: An array or a stdClass object that is a Drupal taxonomy term.

Overrides FeedsElement::__construct

1 call to FeedsTermElement::__construct()
FeedsGeoTermElement::__construct in plugins/FeedsParser.inc
1 method overrides FeedsTermElement::__construct()
FeedsGeoTermElement::__construct in plugins/FeedsParser.inc

File

plugins/FeedsParser.inc, line 165

Class

FeedsTermElement
Encapsulates a taxonomy style term object.

Code

public function __construct($term) {
  if (is_array($term)) {
    parent::__construct($term['name']);
    foreach ($this as $key => $value) {
      $this->{$key} = isset($term[$key]) ? $term[$key] : NULL;
    }
  }
  elseif (is_object($term)) {
    parent::__construct($term->name);
    foreach ($this as $key => $value) {
      $this->{$key} = isset($term->{$key}) ? $term->{$key} : NULL;
    }
  }
}