public function checkIfFieldIsFirstOfItsType($field)
{
- if (isset($this->_seenFieldTypes[$field['type']])) {
+ $type = $field['type'];
+ if (isset($this->_seenFieldTypes[$type])) {
return false;
}
- $this->_seenFieldTypes[$field['type']] = true;
+ $this->_seenFieldTypes[$type] = true;
return true;
}
}
class SelectFromArray extends Field
{
protected $_adminType = 'select2_from_array';
+ protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
protected $_columnType = 'select_from_array';
protected $_columnViewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::columns';
protected $_databaseType = 'string';
{{-- Extra CSS and JS for this particular field --}}
{{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}}
@if ($crud->checkIfFieldIsFirstOfItsType($field))
-
{{-- FIELD CSS - will be loaded in the after_styles section --}}
@push('crud_fields_styles')
<!-- include select2 css-->
initUntriggeredSelectFromArray();
function initUntriggeredSelectFromArray() {
- console.log(':)))');
// trigger select2 for each untriggered select2 box
$('.select2_from_array').each(function (i, obj) {
+ if($(obj).closest('.item.sample').length>0){
+ return;
+ }
+
if (!$(obj).hasClass("select2-hidden-accessible")) {
$(obj).select2({
theme: "bootstrap"