modules/acm/src/Form/ConnectorSettingsForm.php
protected function getCategoryFieldName($node_type, $vid) {
    $fields = $this->entityFieldManager
      ->getFieldDefinitions('node', $node_type);

    // Determine which field is used for categories based on the configured
    // product node type.
    $category_field_name = FALSE;
    foreach ($fields as $field_name => $field_instance) {
      $field_type = $field_instance->getType();
      if ($field_type != 'entity_reference') {
        continue;
      }

      $settings = $field_instance->getSettings();
      if ($settings['target_type'] != 'taxonomy_term') {
        continue;
      }

      if (in_array($vid, $settings['handler_settings']['target_bundles'])) {
        $category_field_name = $field_name;
        break;
      }
    }

    return $category_field_name;
  }
protected function getCategoryFieldName($node_type, $vid) {
    $fields = $this->entityFieldManager
      ->getFieldDefinitions('node', $node_type);

    // Determine which field is used for categories based on the configured
    // product node type.
    $category_field_name = FALSE;
    foreach ($fields as $field_name => $field_instance) {
      $field_type = $field_instance->getType();
      if ($field_type != 'entity_reference') {
        continue;
      }

      $settings = $field_instance->getSettings();
      if ($settings['target_type'] != 'taxonomy_term') {
        continue;
      }

      if (in_array($vid, $settings['handler_settings']['target_bundles'])) {
        $category_field_name = $field_name;
        break;
      }
    }

    return $category_field_name;
  }
protected function getCategoryFieldName ( $ node_type , $ vid ) { $ fields = $ this -> entityFieldManager -> getFieldDefinitions ( 'node' , $ node_type ) ; // Determine which field is used for categories based on the configured // product node type. $ category_field_name = FALSE ; foreach ( $ fields as $ field_name => $ field_instance ) { $ field_type = $ field_instance -> getType ( ) ; if ( $ field_type != 'entity_reference' ) { continue ; } $ settings = $ field_instance -> getSettings ( ) ; if ( $ settings [ 'target_type' ] != 'taxonomy_term' ) { continue ; } if ( in_array ( $ vid , $ settings [ 'handler_settings' ] [ 'target_bundles' ] ) ) { $ category_field_name = $ field_name ; break ; } } return $ category_field_name ; }
Gets the field used to store the category on a given node type.

@param string $node_type
The node type to scan.
@param string $vid
The vocabulary id to check for.

@return string
The Categories field name.
Gets the field used to store the category on a given node type .