You are here

public function BlogapiCommunicator::getTaxonomyFields in Blog API 8

Helper method to find the taxonomy fields in a content type.

Parameters

$node: A node object.

Return value

array Returns the taxonomy fields array.

1 call to BlogapiCommunicator::getTaxonomyFields()
BlogapiCommunicator::setPostCategories in src/BlogapiCommunicator.php
Callback for saving tags on a node.

File

src/BlogapiCommunicator.php, line 164

Class

BlogapiCommunicator
Class BlogapiCommunicator.

Namespace

Drupal\blogapi

Code

public function getTaxonomyFields($node) {
  $taxonomy_fields = [];
  $fields = $node
    ->getFieldDefinitions();
  foreach ($fields as $i => $field) {
    if ($this
      ->fieldIsTaxonomy($field)) {
      $taxonomy_fields[] = $i;
    }
  }
  return $taxonomy_fields;
}