function forum_access_get_tid in Forum Access 8
Get forum tid from entity.
9 calls to forum_access_get_tid()
- CommentForumFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ CommentForumFormatter.php - Builds a renderable array for a field value.
- forum_access_comment_access in ./
forum_access.module - Implements hook_ENTITY_TYPE_access() for comment entities.
- forum_access_entity_access_by_tid in includes/
forum_access.common.inc - Check access for entity.
- forum_access_form_node_form_alter in ./
forum_access.module - Implements hook_form_FORM_ID_alter() for node_form.
- forum_access_form_node_form_get_available_tids in ./
forum_access.module - Get list of available tids for specific account.
File
- includes/
forum_access.common.inc, line 89 - Handle common forum access functionality.
Code
function forum_access_get_tid($entity) {
if ($entity
->hasField('taxonomy_forums') && ($taxonomy_forum = $entity
->get('taxonomy_forums')
->first())) {
return $taxonomy_forum
->getValue()['target_id'];
}
}