Address.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Block\Adminhtml\Order\Create\Billing;
  7. /**
  8. * Adminhtml sales order create billing address block
  9. *
  10. * @api
  11. * @author Magento Core Team <core@magentocommerce.com>
  12. * @SuppressWarnings(PHPMD.DepthOfInheritance)
  13. * @since 100.0.2
  14. */
  15. class Address extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\Address
  16. {
  17. /**
  18. * Return header text
  19. *
  20. * @return \Magento\Framework\Phrase
  21. */
  22. public function getHeaderText()
  23. {
  24. return __('Billing Address');
  25. }
  26. /**
  27. * Return Header CSS Class
  28. *
  29. * @return string
  30. */
  31. public function getHeaderCssClass()
  32. {
  33. return 'head-billing-address';
  34. }
  35. /**
  36. * Prepare Form and add elements to form
  37. *
  38. * @return $this
  39. */
  40. protected function _prepareForm()
  41. {
  42. $this->setJsVariablePrefix('billingAddress');
  43. parent::_prepareForm();
  44. $this->_form->addFieldNameSuffix('order[billing_address]');
  45. $this->_form->setHtmlNamePrefix('order[billing_address]');
  46. $this->_form->setHtmlIdPrefix('order-billing_address_');
  47. return $this;
  48. }
  49. /**
  50. * Return Form Elements values
  51. *
  52. * @return array
  53. */
  54. public function getFormValues()
  55. {
  56. return $this->getCreateOrderModel()->getBillingAddress()->getData();
  57. }
  58. /**
  59. * Return customer address id
  60. *
  61. * @return int|bool
  62. */
  63. public function getAddressId()
  64. {
  65. return $this->getCreateOrderModel()->getBillingAddress()->getCustomerAddressId();
  66. }
  67. /**
  68. * Return billing address object
  69. *
  70. * @return \Magento\Quote\Model\Quote\Address
  71. */
  72. public function getAddress()
  73. {
  74. return $this->getCreateOrderModel()->getBillingAddress();
  75. }
  76. }