@@ -53,16 +53,6 @@ protected function setupUpdateDefaults()
5353 LifecycleHook::hookInto (['list:before_setup ' , 'show:before_setup ' ], function () {
5454 $ this ->crud ->addButton ('line ' , 'update ' , 'view ' , 'crud::buttons.update ' , 'end ' );
5555 });
56-
57- LifecycleHook::hookInto (['list:after_setup ' , 'show:after_setup ' ], function () {
58- // Check if modal form is enabled and replace the button if needed
59- $ useModalForm = $ this ->crud ->get ('update.updateButtonWithModalForm ' ) ?? config ('backpack.operations.update.updateButtonWithModalForm ' , false );
60-
61- if ($ useModalForm ) {
62- $ this ->crud ->removeButton ('update ' );
63- $ this ->crud ->addButton ('line ' , 'update ' , 'view ' , 'crud::buttons.update_in_modal ' , 'end ' );
64- }
65- });
6656 }
6757
6858 /**
@@ -78,38 +68,21 @@ public function edit($id)
7868 // get entry ID from Request (makes sure its the last ID for nested resources)
7969 $ id = $ this ->crud ->getCurrentEntryId () ?? $ id ;
8070
81- // Apply cached form setup if this is an AJAX request from a modal
82- if (request ()->ajax () && request ()->has ('_modal_form_id ' )) {
83- \Backpack \CRUD \app \Library \Support \DataformCache::applySetupClosure ($ this ->crud );
84- }
85-
8671 // register any Model Events defined on fields
8772 $ this ->crud ->registerFieldEvents ();
8873
8974 // get the info for that entry
9075 $ this ->data ['entry ' ] = $ this ->crud ->getEntryWithLocale ($ id );
91-
92- // Attempt to apply cached modal setup first (this will restore
93- // fields and entry if the request included _modal_form_id). If
94- // no cached setup applied, fall back to the regular update fields.
95- $ appliedFromCache = false ;
96- if (request ()->ajax () && request ()->has ('_modal_form_id ' )) {
97- $ appliedFromCache = \Backpack \CRUD \app \Library \Support \DataformCache::applySetupClosure ($ this ->crud );
98- }
99-
100- if (! $ appliedFromCache ) {
101- $ this ->crud ->setOperationSetting ('fields ' , $ this ->crud ->getUpdateFields ());
102- }
103-
76+
77+ $ this ->crud ->setOperationSetting ('fields ' , $ this ->crud ->getUpdateFields ());
78+
10479 $ this ->data ['crud ' ] = $ this ->crud ;
10580 $ this ->data ['saveAction ' ] = $ this ->crud ->getSaveAction ();
10681 $ this ->data ['title ' ] = $ this ->crud ->getTitle () ?? trans ('backpack::crud.edit ' ).' ' .$ this ->crud ->entity_name ;
10782 $ this ->data ['id ' ] = $ id ;
10883
10984 // load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package
110- return request ()->ajax () && request ()->has ('_modal_form_id ' ) ?
111- view ('crud::components.dataform.ajax_response ' , $ this ->data ) :
112- view ($ this ->crud ->getEditView (), $ this ->data );
85+ return view ($ this ->crud ->getEditView (), $ this ->data );
11386 }
11487
11588 /**
0 commit comments