You are here

public function FeedsTermElement::__construct in Feeds 7.2

Same name and namespace in other branches
  1. 6 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 259
Contains FeedsParser and related classes.

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;
    }
  }
}