You are here

public function FeedsTermElement::__construct in Feeds 8.2

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 lib/Drupal/feeds/FeedsGeoTermElement.php
1 method overrides FeedsTermElement::__construct()
FeedsGeoTermElement::__construct in lib/Drupal/feeds/FeedsGeoTermElement.php

File

lib/Drupal/feeds/FeedsTermElement.php, line 24

Class

FeedsTermElement
Encapsulates a taxonomy style term object.

Namespace

Drupal\feeds

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