PropertyMapper.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Catalog attribute property mapper
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Catalog\Model\ResourceModel\Setup;
  9. use Magento\Eav\Model\Entity\Setup\PropertyMapperAbstract;
  10. class PropertyMapper extends PropertyMapperAbstract
  11. {
  12. /**
  13. * Map input attribute properties to storage representation
  14. *
  15. * @param array $input
  16. * @param int $entityTypeId
  17. * @return array
  18. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  19. */
  20. public function map(array $input, $entityTypeId)
  21. {
  22. return [
  23. 'frontend_input_renderer' => $this->_getValue($input, 'input_renderer'),
  24. 'is_global' => $this->_getValue(
  25. $input,
  26. 'global',
  27. \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL
  28. ),
  29. 'is_visible' => $this->_getValue($input, 'visible', 1),
  30. 'is_searchable' => $this->_getValue($input, 'searchable', 0),
  31. 'is_filterable' => $this->_getValue($input, 'filterable', 0),
  32. 'is_comparable' => $this->_getValue($input, 'comparable', 0),
  33. 'is_visible_on_front' => $this->_getValue($input, 'visible_on_front', 0),
  34. 'is_wysiwyg_enabled' => $this->_getValue($input, 'wysiwyg_enabled', 0),
  35. 'is_html_allowed_on_front' => $this->_getValue($input, 'is_html_allowed_on_front', 0),
  36. 'is_visible_in_advanced_search' => $this->_getValue($input, 'visible_in_advanced_search', 0),
  37. 'is_filterable_in_search' => $this->_getValue($input, 'filterable_in_search', 0),
  38. 'used_in_product_listing' => $this->_getValue($input, 'used_in_product_listing', 0),
  39. 'used_for_sort_by' => $this->_getValue($input, 'used_for_sort_by', 0),
  40. 'apply_to' => $this->_getValue($input, 'apply_to'),
  41. 'position' => $this->_getValue($input, 'position', 0),
  42. 'is_used_for_promo_rules' => $this->_getValue($input, 'used_for_promo_rules', 0),
  43. 'is_used_in_grid' => $this->_getValue($input, 'is_used_in_grid', 0),
  44. 'is_visible_in_grid' => $this->_getValue($input, 'is_visible_in_grid', 0),
  45. 'is_filterable_in_grid' => $this->_getValue($input, 'is_filterable_in_grid', 0),
  46. ];
  47. }
  48. }