12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
- /**
- * @api
- * @deprecated 100.2.0 in favour of UI component implementation
- * @since 100.0.2
- */
- class Longtext extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
- {
- /**
- * Render contents as a long text
- *
- * Text will be truncated as specified in string_limit, truncate or 250 by default
- * Also it can be html-escaped and nl2br()
- *
- * @param \Magento\Framework\DataObject $row
- * @return string
- */
- public function render(\Magento\Framework\DataObject $row)
- {
- $truncateLength = 250;
- // stringLength() is for legacy purposes
- if ($this->getColumn()->getStringLimit()) {
- $truncateLength = $this->getColumn()->getStringLimit();
- }
- if ($this->getColumn()->getTruncate()) {
- $truncateLength = $this->getColumn()->getTruncate();
- }
- $text = $this->filterManager->truncate(parent::_getValue($row), ['length' => $truncateLength]);
- if (!$this->getColumn()->hasEscape() || $this->getColumn()->getEscape()) {
- $text = $this->escapeHtml($text);
- }
- if ($this->getColumn()->getNl2br()) {
- $text = nl2br($text);
- }
- return $text;
- }
- }
|