You are here

function commerce_product_block_alter in Commerce Core 8.2

Implements hook_block_alter().

File

modules/product/commerce_product.module, line 383
Defines the Product entity and associated features.

Code

function commerce_product_block_alter(array &$info) {
  if (\Drupal::moduleHandler()
    ->moduleExists('layout_builder')) {
    $base_plugin_id = 'field_block' . PluginBase::DERIVATIVE_SEPARATOR . 'commerce_product_variation' . PluginBase::DERIVATIVE_SEPARATOR;
    foreach ($info as $block_plugin_id => $block_definition) {
      if (strpos($block_plugin_id, $base_plugin_id) !== FALSE) {
        $info[$block_plugin_id]['class'] = VariationFieldBlock::class;
      }
    }
  }
}