modules/acm_customer/src/Plugin/CustomerForm/Addresses.php
protected function buildAddressFields(array &$form, array &$complete_form, array $address = []) {
    $form['address_wrapper'] = [
      '#type' => 'container',
      '#attributes' => [
        'id' => ['address_wrapper'],
        'class' => ['customer-address-form'],
      ],
    ];

    $checkout_config = \Drupal::config('acm_checkout.settings');
    $validate_saved_address = $checkout_config->get('validate_saved_address');
    $address_review_text = $checkout_config->get('saved_address_review_text');
    $address_failed_text = $checkout_config->get('saved_address_failed_text');

    $include_address_id = empty($address) ? FALSE : TRUE;
    $form['address_wrapper']['address'] = [
      '#type' => 'acm_address',
      '#default_value' => $address,
      '#display_title' => TRUE,
      '#display_firstname' => TRUE,
      '#display_lastname' => TRUE,
      '#display_billing' => TRUE,
      '#display_shipping' => TRUE,
      '#include_address_id' => $include_address_id,
      '#validate_address' => $validate_saved_address,
      '#address_review_text' => $address_review_text,
      '#address_failed_text' => $address_failed_text,
    ];

    $form['address_wrapper']['actions'] = [
      '#type' => 'actions',
    ];

    $form['address_wrapper']['actions']['cancel'] = [
      '#type' => 'link',
      '#title' => $this->t('Cancel'),
      '#url' => Url::fromRoute('acm_customer.view_page', [
        'page' => $this->getPageId(),
      ]),
    ];

    $form['address_wrapper']['actions']['save'] = [
      '#type' => 'submit',
      '#value' => $this->t('Save'),
    ];

    // Remove parent actions.
    unset($complete_form['actions']);
  }
protected function buildAddressFields(array &$form, array &$complete_form, array $address = []) {
    $form['address_wrapper'] = [
      '#type' => 'container',
      '#attributes' => [
        'id' => ['address_wrapper'],
        'class' => ['customer-address-form'],
      ],
    ];

    $checkout_config = \Drupal::config('acm_checkout.settings');
    $validate_saved_address = $checkout_config->get('validate_saved_address');
    $address_review_text = $checkout_config->get('saved_address_review_text');
    $address_failed_text = $checkout_config->get('saved_address_failed_text');

    $include_address_id = empty($address) ? FALSE : TRUE;
    $form['address_wrapper']['address'] = [
      '#type' => 'acm_address',
      '#default_value' => $address,
      '#display_title' => TRUE,
      '#display_firstname' => TRUE,
      '#display_lastname' => TRUE,
      '#display_billing' => TRUE,
      '#display_shipping' => TRUE,
      '#include_address_id' => $include_address_id,
      '#validate_address' => $validate_saved_address,
      '#address_review_text' => $address_review_text,
      '#address_failed_text' => $address_failed_text,
    ];

    $form['address_wrapper']['actions'] = [
      '#type' => 'actions',
    ];

    $form['address_wrapper']['actions']['cancel'] = [
      '#type' => 'link',
      '#title' => $this->t('Cancel'),
      '#url' => Url::fromRoute('acm_customer.view_page', [
        'page' => $this->getPageId(),
      ]),
    ];

    $form['address_wrapper']['actions']['save'] = [
      '#type' => 'submit',
      '#value' => $this->t('Save'),
    ];

    // Remove parent actions.
    unset($complete_form['actions']);
  }
protected function buildAddressFields ( array & $ form , array & $ complete_form , array $ address = [ ] ) { $ form [ 'address_wrapper' ] = [ '#type' => 'container' , '#attributes' => [ 'id' => [ 'address_wrapper' ] , 'class' => [ 'customer-address-form' ] , ] , ] ; $ checkout_config = \ Drupal :: config ( 'acm_checkout.settings' ) ; $ validate_saved_address = $ checkout_config -> get ( 'validate_saved_address' ) ; $ address_review_text = $ checkout_config -> get ( 'saved_address_review_text' ) ; $ address_failed_text = $ checkout_config -> get ( 'saved_address_failed_text' ) ; $ include_address_id = empty ( $ address ) ? FALSE : TRUE ; $ form [ 'address_wrapper' ] [ 'address' ] = [ '#type' => 'acm_address' , '#default_value' => $ address , '#display_title' => TRUE , '#display_firstname' => TRUE , '#display_lastname' => TRUE , '#display_billing' => TRUE , '#display_shipping' => TRUE , '#include_address_id' => $ include_address_id , '#validate_address' => $ validate_saved_address , '#address_review_text' => $ address_review_text , '#address_failed_text' => $ address_failed_text , ] ; $ form [ 'address_wrapper' ] [ 'actions' ] = [ '#type' => 'actions' , ] ; $ form [ 'address_wrapper' ] [ 'actions' ] [ 'cancel' ] = [ '#type' => 'link' , '#title' => $ this -> t ( 'Cancel' ) , '#url' => Url :: fromRoute ( 'acm_customer.view_page' , [ 'page' => $ this -> getPageId ( ) , ] ) , ] ; $ form [ 'address_wrapper' ] [ 'actions' ] [ 'save' ] = [ '#type' => 'submit' , '#value' => $ this -> t ( 'Save' ) , ] ; // Remove parent actions. unset ( $ complete_form [ 'actions' ] ) ; }
Builds the address fields.

@param array $form
The form.
@param array $complete_form
The complete form structure.
@param array $address
The default address values.
Builds the address fields .