You are here

interface ProfileFieldCopyInterface in Commerce Shipping 8.2

Copies shared field values from the shipping profile to the billing profile.

Hierarchy

Expanded class hierarchy of ProfileFieldCopyInterface

All classes that implement ProfileFieldCopyInterface

File

src/ProfileFieldCopyInterface.php, line 10

Namespace

Drupal\commerce_shipping
View source
interface ProfileFieldCopyInterface {

  /**
   * Gets whether the given inline form is supported.
   *
   * Confirms that:
   * - The inline form is used for billing information.
   * - The inline form is embedded on a shippable order's page.
   *
   * @param array $inline_form
   *   The inline form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @return bool
   *   TRUE if the element can be attached, FALSE otherwise.
   */
  public function supportsForm(array &$inline_form, FormStateInterface $form_state);

  /**
   * Alters the inline form.
   *
   * Adds the field copy checkbox ("Billing same as shipping').
   * Ensures that field values are copied on submit.
   *
   * @param array $inline_form
   *   The inline form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   */
  public function alterForm(array &$inline_form, FormStateInterface $form_state);

}

Members

Namesort descending Modifiers Type Description Overrides
ProfileFieldCopyInterface::alterForm public function Alters the inline form. 1
ProfileFieldCopyInterface::supportsForm public function Gets whether the given inline form is supported. 1