You are here

private function CommerceSmartImporerService::getExcludedFieldNames in Commerce Smart Importer 8

Helper function for getFieldDefinition, returns excluded fields.

See also

getFieldDefinition()

1 call to CommerceSmartImporerService::getExcludedFieldNames()
CommerceSmartImporerService::getFieldDefinition in src/Plugin/CommerceSmartImporerService.php
Formats field definition for given product and variation type.

File

src/Plugin/CommerceSmartImporerService.php, line 1100
Main Commerce Smart Importer Service.

Class

CommerceSmartImporerService
This is main Commerce Smart Importer Service.

Namespace

Drupal\commerce_smart_importer\Plugin

Code

private function getExcludedFieldNames($with_identifiers = FALSE) {
  $config = $this
    ->getConfig();
  $excluded_fields = [
    'product_id',
    'uuid',
    'langcode',
    'type',
    'status',
    'uid',
    'created',
    'changed',
    'default_langcode',
    'metatag',
    'variations',
    'variation_id',
  ];
  if (!$config['expose_store']) {
    $excluded_fields[] = 'stores';
  }
  if ($with_identifiers) {
    $identifiers = $this
      ->getIdentifierFields();
    foreach ($excluded_fields as $key => $excluded_field) {
      if (in_array($excluded_field, $identifiers['product']) || in_array($excluded_field, $identifiers['variation'])) {
        unset($excluded_fields[$key]);
      }
    }
  }
  return $excluded_fields;
}