You are here

protected function DemoUser::prepareTerms in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  2. 8.2 modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  3. 8.3 modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  4. 8.4 modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  5. 8.5 modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  6. 8.6 modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  7. 8.7 modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  8. 8.8 modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  9. 10.3.x modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  10. 10.0.x modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  11. 10.1.x modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()
  12. 10.2.x modules/custom/social_demo/src/DemoUser.php \Drupal\social_demo\DemoUser::prepareTerms()

Returns taxonomy terms for UUIDs.

Parameters

array $values: A list of UUIDs for terms.

Return value

array Returns an empty array or one filled with taxonomy terms.

1 call to DemoUser::prepareTerms()
DemoUser::createContent in modules/custom/social_demo/src/DemoUser.php
Creates content.

File

modules/custom/social_demo/src/DemoUser.php, line 199

Class

DemoUser
Class DemoUser.

Namespace

Drupal\social_demo

Code

protected function prepareTerms(array $values) {
  $terms = [];
  foreach ($values as $uuid) {
    $term = $this->termStorage
      ->loadByProperties([
      'uuid' => $uuid,
    ]);
    $term = reset($term);
    if (!empty($term)) {
      $terms[] = [
        'target_id' => $term
          ->id(),
      ];
    }
  }
  return $terms;
}