You are here

function commerce_shipping_entity_form_display_alter in Commerce Shipping 8.2

Implements hook_entity_form_display_alter().

File

./commerce_shipping.module, line 94
Provides core shipping functionality.

Code

function commerce_shipping_entity_form_display_alter(EntityFormDisplayInterface $form_display, array $context) {
  if ($context['entity_type'] != 'profile') {
    return;
  }

  // The "shipping" form mode doesn't have a form display yet.
  // Default to hiding the tax_number field, it is only needed for billing.
  if ($context['form_mode'] == 'shipping' && $context['form_mode'] != $form_display
    ->getMode()) {
    $form_display
      ->removeComponent('tax_number');
  }
}