Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Searchquery.php
Go to the documentation of this file.
1 <?php
7 
13 class Searchquery extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
14 {
20  protected $stringHelper;
21 
27  public function __construct(
28  \Magento\Backend\Block\Context $context,
29  \Magento\Framework\Stdlib\StringUtils $stringHelper,
30  array $data = []
31  ) {
32  $this->stringHelper = $stringHelper;
33  parent::__construct($context, $data);
34  }
35 
42  public function render(\Magento\Framework\DataObject $row)
43  {
44  $value = $row->getData($this->getColumn()->getIndex());
45  if ($this->stringHelper->strlen($value) > 30) {
46  $value = '<span title="' . $this->escapeHtml(
47  $value
48  ) . '">' . $this->escapeHtml(
49  $this->filterManager->truncate($value, ['length' => 30])
50  ) . '</span>';
51  } else {
52  $value = $this->escapeHtml($value);
53  }
54  return $value;
55  }
56 }
$value
Definition: gender.phtml:16
__construct(\Magento\Backend\Block\Context $context, \Magento\Framework\Stdlib\StringUtils $stringHelper, array $data=[])
Definition: Searchquery.php:27