You are here

function uc_tax_node_type_update in Ubercart 8.4

Implements hook_node_type_update().

Ensure taxed product type are synchronised if the content type is updated.

File

uc_tax/uc_tax.module, line 163
Ubercart Tax module.

Code

function uc_tax_node_type_update(EntityInterface $info) {
  $original_id = $info
    ->getOriginalId();
  $existing_type = !empty($original_id) ? $info
    ->getOriginalId() : $info
    ->getEntityTypeId();
  $connection = \Drupal::database();
  $connection
    ->update('uc_tax_taxed_product_types')
    ->fields([
    'type' => $info
      ->getEntityTypeId(),
  ])
    ->condition('type', $existing_type)
    ->execute();
}