AddressFieldset.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Customer\Ui\Component\Form;
  8. use Magento\Framework\View\Element\UiComponent\ContextInterface;
  9. use Magento\Framework\View\Element\ComponentVisibilityInterface;
  10. /**
  11. * Customer addresses fieldset class
  12. */
  13. class AddressFieldset extends \Magento\Ui\Component\Form\Fieldset implements ComponentVisibilityInterface
  14. {
  15. /**
  16. * @param ContextInterface $context
  17. * @param array $components
  18. * @param array $data
  19. */
  20. public function __construct(
  21. ContextInterface $context,
  22. array $components = [],
  23. array $data = []
  24. ) {
  25. $this->context = $context;
  26. parent::__construct($context, $components, $data);
  27. }
  28. /**
  29. * Can show customer addresses tab in tabs or not
  30. *
  31. * Will return false for not registered customer in a case when admin user created new customer account.
  32. * Needed to hide addresses tab from create new customer page
  33. *
  34. * @return boolean
  35. */
  36. public function isComponentVisible(): bool
  37. {
  38. $customerId = $this->context->getRequestParam('id');
  39. return (bool)$customerId;
  40. }
  41. }