Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/smart-sl.../Nextend/Framewor.../Form/Element
File: Unit.php
<?php
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
namespace Nextend\Framework\Form\Element;
[3] Fix | Delete
[4] Fix | Delete
[5] Fix | Delete
use Nextend\Framework\Asset\Js\Js;
[6] Fix | Delete
use Nextend\Framework\View\Html;
[7] Fix | Delete
[8] Fix | Delete
class Unit extends AbstractFieldHidden {
[9] Fix | Delete
[10] Fix | Delete
protected $style = '';
[11] Fix | Delete
[12] Fix | Delete
protected $units = array();
[13] Fix | Delete
[14] Fix | Delete
protected function fetchElement() {
[15] Fix | Delete
[16] Fix | Delete
$values = array();
[17] Fix | Delete
[18] Fix | Delete
$html = "<div class='n2_field_unit' style='" . $this->style . "'>";
[19] Fix | Delete
[20] Fix | Delete
$currentValue = $this->getValue();
[21] Fix | Delete
$currentLabel = '';
[22] Fix | Delete
[23] Fix | Delete
$html .= Html::openTag('div', array(
[24] Fix | Delete
'class' => 'n2_field_unit__units'
[25] Fix | Delete
));
[26] Fix | Delete
foreach ($this->units as $unit) {
[27] Fix | Delete
$values[] = $unit;
[28] Fix | Delete
[29] Fix | Delete
$html .= Html::tag('div', array(
[30] Fix | Delete
'class' => 'n2_field_unit__unit'
[31] Fix | Delete
), $unit);
[32] Fix | Delete
[33] Fix | Delete
if ($currentValue == $unit) {
[34] Fix | Delete
$currentLabel = $unit;
[35] Fix | Delete
}
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
$html .= "</div>";
[39] Fix | Delete
[40] Fix | Delete
$html .= Html::tag('div', array(
[41] Fix | Delete
'class' => 'n2_field_unit__current_unit'
[42] Fix | Delete
), $currentLabel);
[43] Fix | Delete
[44] Fix | Delete
$html .= parent::fetchElement();
[45] Fix | Delete
[46] Fix | Delete
$html .= "</div>";
[47] Fix | Delete
[48] Fix | Delete
Js::addInline('new _N2.FormElementUnits("' . $this->fieldID . '", ' . json_encode($values) . ');');
[49] Fix | Delete
[50] Fix | Delete
return $html;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
/**
[54] Fix | Delete
* @param string $style
[55] Fix | Delete
*/
[56] Fix | Delete
public function setStyle($style) {
[57] Fix | Delete
$this->style = $style;
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* @param array $units
[62] Fix | Delete
*/
[63] Fix | Delete
public function setUnits($units) {
[64] Fix | Delete
$this->units = $units;
[65] Fix | Delete
}
[66] Fix | Delete
}
[67] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function