Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Wishlist\Model;
7 
12 class Config
13 {
14  const XML_PATH_SHARING_EMAIL_LIMIT = 'wishlist/email/number_limit';
15 
16  const XML_PATH_SHARING_TEXT_LIMIT = 'wishlist/email/text_limit';
17 
18  const SHARING_EMAIL_LIMIT = 10;
19 
20  const SHARING_TEXT_LIMIT = 255;
21 
25  private $catalogConfig;
26 
30  private $attributeConfig;
31 
37  private $sharingEmailLimit;
38 
44  public function __construct(
45  \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
46  \Magento\Catalog\Model\Config $catalogConfig,
47  \Magento\Catalog\Model\Attribute\Config $attributeConfig
48  ) {
49  $emailLimitInConfig = (int)$scopeConfig->getValue(
50  self::XML_PATH_SHARING_EMAIL_LIMIT,
52  );
53  $textLimitInConfig = (int)$scopeConfig->getValue(
54  self::XML_PATH_SHARING_TEXT_LIMIT,
56  );
57  $this->sharingEmailLimit = $emailLimitInConfig ?: self::SHARING_EMAIL_LIMIT;
58  $this->_sharignTextLimit = $textLimitInConfig ?: self::SHARING_TEXT_LIMIT;
59  $this->catalogConfig = $catalogConfig;
60  $this->attributeConfig = $attributeConfig;
61  }
62 
68  public function getProductAttributes()
69  {
70  $catalogAttributes = $this->catalogConfig->getProductAttributes();
71  $wishlistAttributes = $this->attributeConfig->getAttributeNames('wishlist_item');
72  return array_merge($catalogAttributes, $wishlistAttributes);
73  }
74 
80  public function getSharingEmailLimit()
81  {
82  return $this->sharingEmailLimit;
83  }
84 
90  public function getSharingTextLimit()
91  {
92  return $this->_sharignTextLimit;
93  }
94 }
__construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Config $catalogConfig, \Magento\Catalog\Model\Attribute\Config $attributeConfig)
Definition: Config.php:44