modals laravel背包内的modals
我对laravel背包中的内联创建操作有疑问:是否有可能在内联创建操作中创建模态? 我想要的是,当我使用内联创建操作创建相关项时,我会在这些项中创建其他相关项(类似于内联创建操作中的“内联创建”)。 也许我需要在inline_create_modal中添加一些代码modals laravel背包内的modals,laravel,backpack-for-laravel,Laravel,Backpack For Laravel,我对laravel背包中的内联创建操作有疑问:是否有可能在内联创建操作中创建模态? 我想要的是,当我使用内联创建操作创建相关项时,我会在这些项中创建其他相关项(类似于内联创建操作中的“内联创建”)。 也许我需要在inline_create_modal中添加一些代码 if($activeInlineCreate) { //we check if this field is not beeing requested in some InlineCreate operation. //this va
if($activeInlineCreate) {
//we check if this field is not beeing requested in some InlineCreate operation.
//this variable is setup by InlineCreate modal when loading the fields.
if(!isset($inlineCreate)) {
//by default, when creating an entity we want it to be selected/added to selection.
$field['inline_create']['force_select'] = $field['inline_create']['force_select'] ?? true;
$field['inline_create']['modal_class'] = $field['inline_create']['modal_class'] ?? 'modal-dialog';
//if user don't specify a different entity in inline_create we assume it's the same from $field['entity'] kebabed
$field['inline_create']['entity'] = $field['inline_create']['entity'] ?? $routeEntity;
//route to create a new entity
$field['inline_create']['create_route'] = route($field['inline_create']['entity']."-inline-create-save");
//route to modal
$field['inline_create']['modal_route'] = route($field['inline_create']['entity']."-inline-create");
//include main form fields in the request when asking for modal data,
//allow the developer to modify the inline create modal
//based on some field on the main form
$field['inline_create']['include_main_form_fields'] = $field['inline_create']['include_main_form_fields'] ?? false;
if(!is_bool($field['inline_create']['include_main_form_fields'])) {
if(is_array($field['inline_create']['include_main_form_fields'])) {
$field['inline_create']['include_main_form_fields'] = json_encode($field['inline_create']['include_main_form_fields']);
}else{
//it is a string or treat it like
$arrayed_field = array($field['inline_create']['include_main_form_fields']);
$field['inline_create']['include_main_form_fields'] = json_encode($arrayed_field);
}
}
}
}