protected $_show_empty = true;
protected $_bunch = [];
+ protected $_allowsAdd = true;
+ protected $_allowsDelete = true;
+ protected $_allowsClone = true;
+ protected $_allowsReorder = true;
+
public function getDefaultAttributes()
{
- return array_merge(parent::getDefaultAttributes(), ['bunch' => $this->_bunch, "add_label" => __('Add an item'), 'show_empty' => $this->_show_empty]);
+ return array_merge(parent::getDefaultAttributes(), ['allows_add' => $this->_allowsAdd, 'allows_delete' => $this->_allowsDelete, 'allows_clone' => $this->_allowsClone, 'allows_reorder' => $this->_allowsReorder, 'bunch' => $this->_bunch, "add_label" => __('Add an item'), 'show_empty' => $this->_show_empty]);
}
public function _postSetAttributes()
break;
}
- $this->setAttributeIfNotSet('edit_label',__('Edit « %:name »',['name'=>$first]));
+ $this->setAttributeIfNotSet('edit_label', __('Edit « %:name »', ['name' => $first]));
}
protected function _setBunchOfFields()
$crudfields[$name] = $field->getDefinition();
}
$this->setAttribute('bunchfields', $crudfields);
+
}
}
<div class="bunchmultiple__items" data-bmid="{!! $field['rand'] !!}">
<div class="item sample" data-bmid="{!! $field['rand'] !!}">
<div class="legend" data-bmid="{!! $field['rand'] !!}">
+ @if($field['allows_reorder'])
<a href="#" class="action sort-handle" data-bmid="{!! $field['rand'] !!}">
<i class="la la-sort" role="presentation" aria-hidden="true"></i>
</a>
+ @endif
<span class="legendsize" data-legend="{{$field['edit_label']}}"
data-bmid="{!! $field['rand'] !!}"></span>
<a href="#" class="action edit" data-bmid="{!! $field['rand'] !!}">
<i class="la la-pencil" role="presentation" aria-hidden="true"></i>
</a>
+ @if($field['allows_clone'])
<a href="#" class="action duplicate" data-bmid="{!! $field['rand'] !!}">
<i class="las la-copy"></i>
</a>
- <a href="#" class="action remove" data-bmid="{!! $field['rand'] !!}">
- <i class="la la-trash" role="presentation" aria-hidden="true"></i>
- </a>
-
+ @endif
+ @if($field['allows_delete'])
+ <a href="#" class="action remove" data-bmid="{!! $field['rand'] !!}">
+ <i class="la la-trash" role="presentation" aria-hidden="true"></i>
+ </a>
+ @endif
+ <a> </a>
</div>
<div class="subform" data-bmid="{!! $field['rand'] !!}">
@include('cubist_back::inc.show_bunch_fields', array('bunchfields'=>$field['bunchfields'],'bmid'=>$field['rand']))
</div>
</div>
- <div class="btn-group m-t-10">
- <button class="btn btn-sm btn-default additem" data-bmid="{!! $field['rand'] !!}" type="button"><i
- class="la la-plus"></i> {{$field['add_label']}}</button>
- </div>
+ @if($field['allows_add'])
+ <div class="btn-group m-t-10">
+ <button class="btn btn-sm btn-default additem" data-bmid="{!! $field['rand'] !!}" type="button"><i
+ class="la la-plus"></i> {{$field['add_label']}}</button>
+ </div>
+ @endif
<div class="clearfix"></div>