class BillingInformation in Commerce Core 8.2
Provides the billing information pane.
Plugin annotation
@CommerceCheckoutPane(
  id = "billing_information",
  label = @Translation("Billing information"),
  default_step = "order_information",
  wrapper_element = "fieldset",
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait- class \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase implements CheckoutPaneInterface, ContainerFactoryPluginInterface- class \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\BillingInformation implements CheckoutPaneInterface
 
 
- class \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase implements CheckoutPaneInterface, ContainerFactoryPluginInterface
 
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of BillingInformation
File
- modules/checkout/ src/ Plugin/ Commerce/ CheckoutPane/ BillingInformation.php, line 21 
Namespace
Drupal\commerce_checkout\Plugin\Commerce\CheckoutPaneView source
class BillingInformation extends CheckoutPaneBase implements CheckoutPaneInterface {
  /**
   * The inline form manager.
   *
   * @var \Drupal\commerce\InlineFormManager
   */
  protected $inlineFormManager;
  /**
   * Constructs a new BillingInformation object.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowInterface $checkout_flow
   *   The parent checkout flow.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\commerce\InlineFormManager $inline_form_manager
   *   The inline form manager.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, CheckoutFlowInterface $checkout_flow, EntityTypeManagerInterface $entity_type_manager, InlineFormManager $inline_form_manager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $checkout_flow, $entity_type_manager);
    $this->inlineFormManager = $inline_form_manager;
  }
  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, CheckoutFlowInterface $checkout_flow = NULL) {
    return new static($configuration, $plugin_id, $plugin_definition, $checkout_flow, $container
      ->get('entity_type.manager'), $container
      ->get('plugin.manager.commerce_inline_form'));
  }
  /**
   * {@inheritdoc}
   */
  public function buildPaneSummary() {
    $summary = [];
    if ($profile = $this->order
      ->getBillingProfile()) {
      $profile_view_builder = $this->entityTypeManager
        ->getViewBuilder('profile');
      $summary = $profile_view_builder
        ->view($profile, 'default');
    }
    return $summary;
  }
  /**
   * {@inheritdoc}
   */
  public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
    $profile = $this->order
      ->getBillingProfile();
    if (!$profile) {
      $profile_storage = $this->entityTypeManager
        ->getStorage('profile');
      $profile = $profile_storage
        ->create([
        'type' => 'customer',
        'uid' => 0,
      ]);
    }
    $inline_form = $this->inlineFormManager
      ->createInstance('customer_profile', [
      'profile_scope' => 'billing',
      'available_countries' => $this->order
        ->getStore()
        ->getBillingCountries(),
      'address_book_uid' => $this->order
        ->getCustomerId(),
      // Don't copy the profile to address book until the order is placed.
      'copy_on_save' => FALSE,
    ], $profile);
    $pane_form['profile'] = [
      '#parents' => array_merge($pane_form['#parents'], [
        'profile',
      ]),
      '#inline_form' => $inline_form,
    ];
    $pane_form['profile'] = $inline_form
      ->buildInlineForm($pane_form['profile'], $form_state);
    return $pane_form;
  }
  /**
   * {@inheritdoc}
   */
  public function submitPaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
    /** @var \Drupal\commerce\Plugin\Commerce\InlineForm\EntityInlineFormInterface $inline_form */
    $inline_form = $pane_form['profile']['#inline_form'];
    /** @var \Drupal\profile\Entity\ProfileInterface $profile */
    $profile = $inline_form
      ->getEntity();
    $this->order
      ->setBillingProfile($profile);
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| BillingInformation:: | protected | property | The inline form manager. | |
| BillingInformation:: | public | function | Builds the pane form. Overrides CheckoutPaneInterface:: | |
| BillingInformation:: | public | function | Builds a summary of the pane values. Overrides CheckoutPaneBase:: | |
| BillingInformation:: | public static | function | Creates an instance of the plugin. Overrides CheckoutPaneBase:: | |
| BillingInformation:: | public | function | Handles the submission of an pane form. Overrides CheckoutPaneBase:: | |
| BillingInformation:: | public | function | Constructs a new BillingInformation object. Overrides CheckoutPaneBase:: | |
| CheckoutPaneBase:: | protected | property | The parent checkout flow. | |
| CheckoutPaneBase:: | protected | property | The entity type manager. | |
| CheckoutPaneBase:: | protected | property | The current order. | |
| CheckoutPaneBase:: | public | function | Form constructor. Overrides PluginFormInterface:: | 6 | 
| CheckoutPaneBase:: | public | function | Builds a summary of the pane configuration. Overrides CheckoutPaneInterface:: | 5 | 
| CheckoutPaneBase:: | public | function | Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: | |
| CheckoutPaneBase:: | public | function | Gets default configuration for this plugin. Overrides ConfigurableInterface:: | 6 | 
| CheckoutPaneBase:: | public | function | Gets this plugin's configuration. Overrides ConfigurableInterface:: | |
| CheckoutPaneBase:: | public | function | Gets the pane display label. Overrides CheckoutPaneInterface:: | |
| CheckoutPaneBase:: | public | function | Gets the pane ID. Overrides CheckoutPaneInterface:: | |
| CheckoutPaneBase:: | public | function | Gets the pane label. Overrides CheckoutPaneInterface:: | |
| CheckoutPaneBase:: | public | function | Gets the pane step ID. Overrides CheckoutPaneInterface:: | |
| CheckoutPaneBase:: | public | function | Gets the pane weight. Overrides CheckoutPaneInterface:: | |
| CheckoutPaneBase:: | public | function | Gets the pane wrapper element. Overrides CheckoutPaneInterface:: | |
| CheckoutPaneBase:: | public | function | Determines whether the pane is visible. Overrides CheckoutPaneInterface:: | 4 | 
| CheckoutPaneBase:: | public | function | Sets the configuration for this plugin instance. Overrides ConfigurableInterface:: | |
| CheckoutPaneBase:: | public | function | Sets the current order. Overrides CheckoutPaneInterface:: | |
| CheckoutPaneBase:: | public | function | Sets the pane step ID. Overrides CheckoutPaneInterface:: | |
| CheckoutPaneBase:: | public | function | Sets the pane weight. Overrides CheckoutPaneInterface:: | |
| CheckoutPaneBase:: | public | function | Form submission handler. Overrides PluginFormInterface:: | 6 | 
| CheckoutPaneBase:: | public | function | Form validation handler. Overrides PluginFormInterface:: | |
| CheckoutPaneBase:: | public | function | Validates the pane form. Overrides CheckoutPaneInterface:: | 4 | 
| DependencySerializationTrait:: | protected | property | An array of entity type IDs keyed by the property name of their storages. | |
| DependencySerializationTrait:: | protected | property | An array of service IDs keyed by property name used for serialization. | |
| DependencySerializationTrait:: | public | function | 1 | |
| DependencySerializationTrait:: | public | function | 2 | |
| MessengerTrait:: | protected | property | The messenger. | 29 | 
| MessengerTrait:: | public | function | Gets the messenger. | 29 | 
| MessengerTrait:: | public | function | Sets the messenger. | |
| PluginBase:: | protected | property | Configuration information passed into the plugin. | 1 | 
| PluginBase:: | protected | property | The plugin implementation definition. | 1 | 
| PluginBase:: | protected | property | The plugin_id. | |
| PluginBase:: | constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
| PluginBase:: | public | function | Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: | |
| PluginBase:: | public | function | Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: | |
| PluginBase:: | public | function | Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: | 3 | 
| PluginBase:: | public | function | Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: | |
| PluginBase:: | public | function | Determines if the plugin is configurable. | |
| StringTranslationTrait:: | protected | property | The string translation service. | 1 | 
| StringTranslationTrait:: | protected | function | Formats a string containing a count of items. | |
| StringTranslationTrait:: | protected | function | Returns the number of plurals supported by a given language. | |
| StringTranslationTrait:: | protected | function | Gets the string translation service. | |
| StringTranslationTrait:: | public | function | Sets the string translation service to use. | 2 | 
| StringTranslationTrait:: | protected | function | Translates a string to the current language or to a given language. | 
