Data.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Bundle\Helper;
  7. /**
  8. * Bundle helper
  9. *
  10. * @author Magento Core Team <core@magentocommerce.com>
  11. */
  12. class Data extends \Magento\Framework\App\Helper\AbstractHelper
  13. {
  14. /**
  15. * @var \Magento\Catalog\Model\ProductTypes\ConfigInterface
  16. */
  17. protected $config;
  18. /**
  19. * @param \Magento\Framework\App\Helper\Context $context
  20. * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $config
  21. */
  22. public function __construct(
  23. \Magento\Framework\App\Helper\Context $context,
  24. \Magento\Catalog\Model\ProductTypes\ConfigInterface $config
  25. ) {
  26. $this->config = $config;
  27. parent::__construct($context);
  28. }
  29. /**
  30. * Retrieve array of allowed product types for bundle selection product
  31. *
  32. * @return array
  33. */
  34. public function getAllowedSelectionTypes()
  35. {
  36. $configData = $this->config->getType(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE);
  37. return isset($configData['allowed_selection_types']) ? $configData['allowed_selection_types'] : [];
  38. }
  39. }