protected function FeedsTermProcessor::entitySave in Feeds 8.2
Saves a term.
We de-array parent fields with only one item. This stops leftandright module from freaking out.
Overrides FeedsProcessor::entitySave
File
- lib/
Drupal/ feeds/ Plugin/ feeds/ processor/ FeedsTermProcessor.php, line 75 - FeedsTermProcessor class.
Class
- FeedsTermProcessor
- Defines a taxonomy term processor.
Namespace
Drupal\feeds\Plugin\feeds\processorCode
protected function entitySave($term) {
if (isset($term->parent)) {
if (is_array($term->parent) && count($term->parent) == 1) {
$term->parent = reset($term->parent);
}
if ($term
->id() && ($term->parent == $term
->id() || is_array($term->parent) && in_array($term
->id(), $term->parent))) {
throw new FeedsValidationException(t("A term can't be its own child. GUID:@guid", array(
'@guid' => $term->feeds_item->guid,
)));
}
}
$term
->save();
}