protected $_showSeletedOption = false;
+ protected $_free = false;
+
public function getDefaultAttributes()
{
return array_merge(parent::getDefaultAttributes(), [
'allows_multiple' => $this->_multiple,
'ajax' => $this->_ajax,
'allows_html' => $this->_allowsHTML,
- 'show_selected_option' => $this->_showSeletedOption
+ 'show_selected_option' => $this->_showSeletedOption,
+ 'free' => $this->_free,
]);
}
@if($ajax) data-ajax="{{$field['ajax']}}" @endif
@if($allows_html) data-allow-html="1" @endif
data-options="{{ json_encode($field['options']) }}"
+ @if($field['free']) data-free="1" @endif
data-value="{{is_scalar($o)?$o:json_encode($o)}}"
>
@if (isset($field['allows_null']) && $field['allows_null']==true)
var options = {
theme: "bootstrap",
};
+ options.tags = $(this).is('[data-free]');
if ($(this).is('[data-ajax]')) {
options.ajax = {
url: '{{backpack_url('select2')}}' + '/' + $(this).data('ajax'),