You are here

function _tft_get_group_tid in Taxonomy File Tree 8

Same name and namespace in other branches
  1. 3.x tft.module \_tft_get_group_tid()

Get the term tid associated with the Group.

Parameters

int $gid: The Group id.

Return value

int|null The term tid.

1 call to _tft_get_group_tid()
TFTController::listGroup in src/Controller/TFTController.php
Returns group list.

File

./tft.module, line 102
Contains tft.module.

Code

function _tft_get_group_tid($gid) {
  $group = Group::load($gid);
  if ($group
    ->hasField('field_learning_path_folder')) {
    $value = $group
      ->get('field_learning_path_folder')
      ->getValue();
    $tid = reset($value)['target_id'];
    return $tid;
  }
  return NULL;
}