You are here

protected function ContentImporter::processCommerce in Commerce Demo 8

Same name and namespace in other branches
  1. 8.2 src/ContentImporter.php \Drupal\commerce_demo\ContentImporter::processCommerce()

Processes Commerce entity values before importing.

Parameters

array $values: The entity values.

\Drupal\Core\Entity\ContentEntityInterface $entity: The Commerce entity.

Return value

array The processed entity values.

1 call to ContentImporter::processCommerce()
ContentImporter::importEntity in src/ContentImporter.php
Imports a given entity.

File

src/ContentImporter.php, line 202

Class

ContentImporter
Defines the content importer.

Namespace

Drupal\commerce_demo

Code

protected function processCommerce(array $values, ContentEntityInterface $entity) {
  $store = $this
    ->ensureStore();
  if ($entity
    ->hasField('stores')) {
    $values['stores'] = [
      $store,
    ];
  }
  elseif ($entity
    ->hasField('store')) {
    $values['store'] = $store;
  }
  return $values;
}