当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractRenderer::_getValue方法代码示例

本文整理汇总了PHP中Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer::_getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractRenderer::_getValue方法的具体用法?PHP AbstractRenderer::_getValue怎么用?PHP AbstractRenderer::_getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer的用法示例。


在下文中一共展示了AbstractRenderer::_getValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Renders grid column
  *
  * @param \Magento\Framework\Object $row
  * @return string
  */
 public function render(\Magento\Framework\Object $row)
 {
     $line = parent::_getValue($row);
     $wrappedLine = '';
     $lineLength = $this->getColumn()->getData('lineLength') ? $this->getColumn()->getData('lineLength') : $this->_defaultMaxLineLength;
     for ($i = 0, $n = floor($this->string->strlen($line) / $lineLength); $i <= $n; $i++) {
         $wrappedLine .= $this->string->substr($line, $lineLength * $i, $lineLength) . "<br />";
     }
     return $wrappedLine;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:16,代码来源:Wrapline.php

示例2: _getValue

 /**
  * @param \Magento\Framework\DataObject $row
  * @return int|string
  */
 protected function _getValue(\Magento\Framework\DataObject $row)
 {
     $data = parent::_getValue($row);
     if (intval($data) == $data) {
         return (string) number_format($data, 2);
     }
     if ($data !== null) {
         return $data * 1;
     }
     return $this->getColumn()->getDefault();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:Data.php

示例3: _getValue

 /**
  * Returns value of the row
  *
  * @param \Magento\Framework\Object $row
  * @return mixed|string
  */
 protected function _getValue(\Magento\Framework\Object $row)
 {
     $data = parent::_getValue($row);
     if (!is_null($data)) {
         $value = $data * 1;
         $sign = (bool) (int) $this->getColumn()->getShowNumberSign() && $value > 0 ? '+' : '';
         if ($sign) {
             $value = $sign . $value;
         }
         // fixed for showing zero in grid
         return $value ? $value : '0';
     }
     return $this->getColumn()->getDefault();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:20,代码来源:Number.php

示例4: render

 /**
  * 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\Object $row
  * @return string
  */
 public function render(\Magento\Framework\Object $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()->getEscape()) {
         $text = $this->escapeHtml($text);
     }
     if ($this->getColumn()->getNl2br()) {
         $text = nl2br($text);
     }
     return $text;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:28,代码来源:Longtext.php

示例5: _getValue

 /**
  * Renders grid column
  *
  * @param \Magento\Framework\DataObject $row
  * @return mixed
  */
 public function _getValue(\Magento\Framework\DataObject $row)
 {
     $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null;
     $defaultValue = $this->getColumn()->getDefault();
     if ($format === null) {
         // If no format and it column not filtered specified return data as is.
         $data = parent::_getValue($row);
         $string = $data === null ? $defaultValue : $data;
         return $this->escapeHtml($string);
     } elseif (preg_match_all($this->_variablePattern, $format, $matches)) {
         // Parsing of format string
         $formattedString = $format;
         foreach ($matches[0] as $matchIndex => $match) {
             $value = $row->getData($matches[1][$matchIndex]);
             $formattedString = str_replace($match, $value, $formattedString);
         }
         return $formattedString;
     } else {
         return $this->escapeHtml($format);
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:27,代码来源:Text.php


注:本文中的Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer::_getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。