Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Data.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Review\Helper;
8 
16 {
17  const XML_REVIEW_GUETS_ALLOW = 'catalog/review/allow_guest';
18 
24  protected $filter;
25 
31  protected $_escaper;
32 
38  public function __construct(
39  \Magento\Framework\App\Helper\Context $context,
40  \Magento\Framework\Escaper $escaper,
41  \Magento\Framework\Filter\FilterManager $filter
42  ) {
43  $this->_escaper = $escaper;
44  $this->filter = $filter;
45  parent::__construct($context);
46  }
47 
54  public function getDetail($origDetail)
55  {
56  return nl2br($this->filter->truncate($origDetail, ['length' => 50]));
57  }
58 
65  public function getDetailHtml($origDetail)
66  {
67  return nl2br($this->filter->truncate($this->_escaper->escapeHtml($origDetail), ['length' => 50]));
68  }
69 
76  public function getIsGuestAllowToWrite()
77  {
78  return $this->scopeConfig->isSetFlag(
79  self::XML_REVIEW_GUETS_ALLOW,
80  \Magento\Store\Model\ScopeInterface::SCOPE_STORE
81  );
82  }
83 
89  public function getReviewStatuses()
90  {
91  return [
95  ];
96  }
97 
104  {
105  $result = [];
106  foreach ($this->getReviewStatuses() as $value => $label) {
107  $result[] = ['value' => $value, 'label' => $label];
108  }
109 
110  return $result;
111  }
112 }
getDetailHtml($origDetail)
Definition: Data.php:65
__()
Definition: __.php:13
$label
Definition: details.phtml:21
$value
Definition: gender.phtml:16
__construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\Escaper $escaper, \Magento\Framework\Filter\FilterManager $filter)
Definition: Data.php:38
getDetail($origDetail)
Definition: Data.php:54
const XML_REVIEW_GUETS_ALLOW
Definition: Data.php:17