You are here

protected function TaxonomyTermMatch::extractParentAttribute in Acquia Content Hub 8.2

Extracts 'parent' attribute from CDF object.

Parameters

\Acquia\ContentHubClient\CDF\CDFObject $object: CDF Object.

Return value

array|null Attribute value or NULL.

1 call to TaxonomyTermMatch::extractParentAttribute()
TaxonomyTermMatch::onLoadLocalEntity in modules/acquia_contenthub_subscriber/src/EventSubscriber/LoadLocalEntity/TaxonomyTermMatch.php
Load local terms with the same name, vocabulary and relative parent.

File

modules/acquia_contenthub_subscriber/src/EventSubscriber/LoadLocalEntity/TaxonomyTermMatch.php, line 129

Class

TaxonomyTermMatch
Class TaxonomyTermMatch.

Namespace

Drupal\acquia_contenthub_subscriber\EventSubscriber\LoadLocalEntity

Code

protected function extractParentAttribute(CDFObject $object) {
  $parent_attribute = $object
    ->getAttribute('parent');
  if (empty($parent_attribute)) {
    return [
      '0',
    ];
  }
  $attribute_value = $parent_attribute
    ->getValue();
  if (empty($attribute_value[CDFObject::LANGUAGE_UNDETERMINED])) {
    return [
      '0',
    ];
  }
  return $attribute_value[CDFObject::LANGUAGE_UNDETERMINED];
}