Sidebar.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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;
  7. /**
  8. * Adminhtml sales order create sidebar
  9. *
  10. * @api
  11. * @author Magento Core Team <core@magentocommerce.com>
  12. * @since 100.0.2
  13. */
  14. class Sidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate
  15. {
  16. /**
  17. * Preparing global layout
  18. *
  19. * @return $this
  20. */
  21. protected function _prepareLayout()
  22. {
  23. if ($this->getCustomerId()) {
  24. $button = $this->getLayout()->createBlock(
  25. \Magento\Backend\Block\Widget\Button::class
  26. )->setData(
  27. [
  28. 'label' => __('Update Changes'),
  29. 'onclick' => 'order.sidebarApplyChanges()',
  30. 'class' => 'action-secondary',
  31. 'before_html' => '<div class="actions">',
  32. 'after_html' => '</div>',
  33. ]
  34. );
  35. $this->setChild('top_button', $button);
  36. }
  37. if ($this->getCustomerId()) {
  38. $button = clone $button;
  39. $button->unsId();
  40. $this->setChild('bottom_button', $button);
  41. }
  42. return parent::_prepareLayout();
  43. }
  44. /**
  45. * Check if can display
  46. *
  47. * @param \Magento\Framework\DataObject $child
  48. * @return true
  49. */
  50. public function canDisplay($child)
  51. {
  52. if (method_exists($child, 'canDisplay') && is_callable([$child, 'canDisplay'])) {
  53. return $child->canDisplay();
  54. }
  55. return true;
  56. }
  57. }