|
Server : Apache System : Linux s1230 5.15.0-139-generic #149~20.04.1 SMP Tue Jul 14 11:21:49 UTC 2026 x86_64 User : p141464 ( 418825) PHP Version : 7.4.33.12 Disable Function : NONE Directory : /html/KMU-CSR-PLANER/wp-content/themes/betheme/visual-builder/assets/js/forms/fields/ |
Upload File : |
function mfn_field_switcher(field, rwd) {
let html = '';
let classes = ['mfn-switch'];
let value = field.obj_val;
let option = _.has(field, 'option') ? field.option : '1';
if( _.has(field, 'value') ){
value = field.value;
}
let id_attr = 'switcher-'+field.id+'-'+Math.floor(Math.random() * 1000)+'-'+Math.floor(Math.random() * 1000)+'-'+Math.floor(Math.random() * 1000);
if( _.has(field, 'invert') ) classes.push('inverted');
html += `
<div class="${classes.join(' ')}">
<input id="${id_attr}" name="${field.id}" ${ option == value ? 'checked' : '' } value="${option}" class="mfn-field-value" type="checkbox">
<label for="${id_attr}" class="switch"></label>
</div>
<span class="mfn-switch-label">
${_.has(field, 'title') ? field.title : ''}
${_.has(field, 'desc') ? `<span class="mfn-switch-label-desc">${field.desc}</span>` : ''}
</span>
`;
return html;
}