: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Nextend\Framework\Form\Element;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\AbstractField;
use Nextend\Framework\Form\ContainerInterface;
use Nextend\Framework\Form\TraitFieldset;
use Nextend\Framework\View\Html;
class Text extends AbstractField implements ContainerInterface {
protected $attributes = array();
public $fieldType = 'text';
protected function addScript() {
Js::addInline('new _N2.FormElementText("' . $this->fieldID . '");');
protected function fetchElement() {
if ($this->getValue() === '') {
$this->class .= 'n2_field_text--empty ';
$html = Html::openTag('div', array(
'class' => 'n2_field_text ' . $this->getClass()
$html .= Html::tag('input', $this->attributes + array(
'type' => $this->fieldType,
'name' => $this->getFieldName(),
'value' => $this->getValue(),
'style' => $this->getStyle(),
if (!empty($this->unit)) {
$html .= Html::tag('div', array(
'class' => 'n2_field_text__unit'
public function setUnit($unit) {
protected function pre() {
protected function post() {
$html .= $this->decorateElement($element);
$element = $element->getNext();
return '<div class="n2_field_text__post">' . $html . '</div>';
* @param AbstractField $element
public function decorateElement($element) {
list($label, $fieldHTML) = $element->render();