.
*/
namespace HTMLBuilder\Wrapper;
use Modules;
/**
* @since 2.3
*/
class HTMLWrapper implements WrapperInterface
{
public function before(&$values, &$extras)
{
$result = '';
$extra_class = '';
if( $values['type']=='checkbox' ){
$extra_class = 'checkbox-group';
}
// Valori particolari
$values['icon-before'] = isset($values['icon-before']) ? $this->parser($values, $extras, $values['icon-before']) : null;
$values['icon-after'] = isset($values['icon-after']) ? $this->parser($values, $extras, $values['icon-after']) : null;
$result .= '
';
if (!empty($values['label'])) {
unset($values['label']);
}
if (!empty($values['validation'])) {
$values['valid'] = '1';
$value = explode('|', $values['validation']);
$name = $value[0];
$id_module = isset($value[1]) ? $value[1] : '$id_module$';
$id_record = isset($value[2]) ? $value[2] : '$id_record$';
$result .= '
';
}
return $result;
}
protected function parser(&$values, &$extras, $string)
{
$result = $string;
if (string_starts_with($string, 'add|')) {
$result = $this->add($values, $extras, $string);
$values['icon-custom'] = 'no-padding';
} elseif (string_starts_with($string, 'choice|')) {
$result = $this->choice($values, $extras, $string);
$values['icon-custom'] = 'no-padding';
}
if (string_contains($string, '