JBZoo\SimpleTypes\Formatter::html PHP Метод

html() публичный Метод

public html ( array $current, array $orig, array $params ) : string
$current array
$orig array
$params array
Результат string
    public function html($current, $orig, $params)
    {
        $data = $this->_format($current['value'], $current['rule']);
        $rData = $this->get($current['rule']);
        $result = str_replace(array('%v', '%s'), array('<span class="simpleType-value">' . $data['value'] . '</span>', '<span class="simpleType-symbol">' . $rData['symbol'] . '</span>'), $data['template']);
        return '<span ' . $this->htmlAttributes(array('class' => array('simpleType', 'simpleType-block', 'simpleType-' . $this->_type), 'data-simpleType-id' => $params['id'], 'data-simpleType-value' => $current['value'], 'data-simpleType-rule' => $current['rule'], 'data-simpleType-orig-value' => $orig['value'], 'data-simpleType-orig-rule' => $orig['rule'])) . '>' . $result . '</span>';
    }

Usage Example

Пример #1
0
 /**
  * @param $rule
  * @return string
  * @throws \JBZoo\SimpleTypes\Exception
  */
 public function html($rule = null)
 {
     $rule = $rule ? $this->_parser->checkRule($rule) : $this->_rule;
     $this->log('Formatted output in "' . $rule . '" as "html"');
     return $this->_formatter->html(array('value' => $this->val($rule), 'rule' => $rule), array('value' => $this->_value, 'rule' => $this->_rule), array('id' => $this->_uniqueId));
 }