You are here

function commerce_order_post_update_11 in Commerce Core 8.2

Add the "admin" view mode to profiles.

File

modules/order/commerce_order.post_update.php, line 173
Post update functions for Order.

Code

function commerce_order_post_update_11() {
  if (!ProfileType::load('customer')) {

    // Commerce expects the "customer" profile type to always be present,
    // but some sites have still succeeded in removing it.
    return '';
  }

  /** @var \Drupal\commerce\Config\ConfigUpdaterInterface $config_updater */
  $config_updater = \Drupal::service('commerce.config_updater');
  $result = $config_updater
    ->import([
    'core.entity_view_mode.profile.admin',
    'core.entity_view_display.profile.customer.admin',
  ]);
  $message = implode('<br>', $result
    ->getFailed());
  return $message;
}