You are here

protected function ProfileFieldCopy::getCopyLabel in Commerce Shipping 8.2

Gets the copy label for the given inline form.

Parameters

array $inline_form: The inline form.

Return value

string The copy label.

1 call to ProfileFieldCopy::getCopyLabel()
ProfileFieldCopy::alterForm in src/ProfileFieldCopy.php
Alters the inline form.

File

src/ProfileFieldCopy.php, line 160

Class

ProfileFieldCopy
Default implementation of profile field copying ("Billing same as shipping").

Namespace

Drupal\commerce_shipping

Code

protected function getCopyLabel(array $inline_form) {

  /** @var \Drupal\commerce\Plugin\Commerce\InlineForm\EntityInlineFormInterface $plugin */
  $plugin = $inline_form['#inline_form'];
  $configuration = $plugin
    ->getConfiguration();
  $is_owner = FALSE;
  if (empty($configuration['admin'])) {
    $is_owner = $this->currentUser
      ->id() == $configuration['address_book_uid'];
  }
  if ($is_owner) {
    $copy_label = $this
      ->t('My billing information is the same as my shipping information.');
  }
  else {
    $copy_label = $this
      ->t('Billing information is the same as the shipping information.');
  }
  return $copy_label;
}