class FeedsTermElement in Feeds 8.2
Encapsulates a taxonomy style term object.
Objects of this class can be turned into a taxonomy term style arrays by casting them.
$term_object = new FeedsTermElement($term_array);
$term_array = (array) $term_object;
Hierarchy
- class \Drupal\feeds\FeedsElement
- class \Drupal\feeds\FeedsTermElement
Expanded class hierarchy of FeedsTermElement
1 file declares its use of FeedsTermElement
- taxonomy.inc in mappers/
taxonomy.inc - On behalf implementation of Feeds mapping API for taxonomy.module.
File
- lib/
Drupal/ feeds/ FeedsTermElement.php, line 17
Namespace
Drupal\feedsView source
class FeedsTermElement extends FeedsElement {
public $tid, $vid, $name;
/**
* @param $term
* An array or a stdClass object that is a Drupal taxonomy term.
*/
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;
}
}
}
/**
* Use $name as $value.
*/
public function getValue() {
return $this->name;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedsElement:: |
protected | property | ||
FeedsElement:: |
public | function | Magic method __toString() for printing and string conversion of this object. | |
FeedsTermElement:: |
public | property | ||
FeedsTermElement:: |
public | function |
Use $name as $value. Overrides FeedsElement:: |
|
FeedsTermElement:: |
public | function |
Overrides FeedsElement:: |
1 |