private function container_enclosed_elements($element, $attrib, $rtForm_options)
{
$html = $id = '';
$size = count($rtForm_options);
if (isset($attrib['id'])) {
$id = $attrib['id'];
}
foreach ($rtForm_options as $opt) {
if (isset($attrib['id']) && $size > 1) {
$attrib['id'] = $id . '-' . $this->get_default_id($element);
$this->update_default_id($element);
}
foreach ((array) $opt as $key => $val) {
if ('checked' === $key) {
$attrib['checked'] = esc_attr($val);
} else {
if ('selected' === $key) {
$attrib['selected'] = esc_attr($val);
} else {
if ('desc' === $key) {
$attrib['desc'] = esc_attr($val);
} else {
if ('id' === $key) {
$attrib['id'] = esc_attr($val);
} else {
$attrib['key'] = $key;
$attrib['value'] = esc_attr($val);
}
}
}
}
}
$checked = isset($attrib['checked']) && $attrib['checked'] ? 'checked=checked' : '';
if (isset($attrib['switch']) && $attrib['switch']) {
$switch = 'data-toggle="switch"';
} else {
$switch = '';
}
$data = '';
switch ($element) {
case 'rtRadio':
$data = '<input type="radio" ' . $checked . ' ';
break;
case 'rtCheckbox':
$data = '<input type="checkbox" ' . $checked . ' ' . $switch . ' ';
break;
case 'rtSelect':
$selected = $attrib['selected'] ? 'selected=selected' : '';
$data = '<option value="' . esc_attr($attrib['value']) . '" ' . $selected . '>' . esc_html($attrib['key']) . '</option>';
break;
}
if ('rtSelect' !== $element) {
$data .= $this->processAttributes($element, $attrib, true);
// span elements for checkbox on/off switch
if ('rtCheckbox' === $element) {
$data .= '<span class="switch-label" data-on="On" data-off="Off"></span><span class="switch-handle"></span>';
}
if (isset($attrib['switch_square']) && $attrib['switch_square']) {
$data = '<div class="rt-switch switch-square" data-on-label="<i class=\'fui-check\'></i>" data-off-label="<i class=\'fui-cross\'></i>">' . $data . '</div>';
} else {
if (isset($attrib['switch']) && $attrib['switch'] || isset($attrib['switch_square']) && $attrib['switch_square']) {
$label_class = array('switch');
$data = $this->enclose_label($element, $data, $attrib['key'], $label_class);
if ($size > 1) {
$data = '<div>' . $data . '</div>';
}
} else {
$data = $this->enclose_label($element, $data, $attrib['key']);
}
}
$data .= '';
}
$html .= $data;
unset($attrib['id']);
unset($attrib['key']);
unset($attrib['value']);
}
return $html;
}