by
KK » Fri Feb 16, 2018 12:07 am
What can I do if the customer always wants to restructure something.
Of course, I understand. This usually is an infrequent thing to do on an established site, though.
Anyway, I have tried to prepare a solution for you (goes without saying that I assume you are using v2.x).
But first, if you have removed the K_IGNORE_CONTEXT from your custom routed template, as I suggested before, please first put that statement back (i.e. revert back to using the custom routes just as you were before our conversation).
It is also *always* advisable to take a full database backup before attempting any structural changes to the tables (be it Couch or any other software). Do make sure to take one before proceeding.
Ok, now place the following code in your 'couch/addons/kfunctions.php' file -
- Code: Select all
// Allow deletion of fields when using custom routes
$FUNCS->add_event_listener( 'post_process_page_start', 'my_post_process_page' );
function my_post_process_page(){
global $PAGE, $CTX;
if( $CTX->ignore_context ){
$PAGE->is_master=0;
}
}
And now if you visit the template using custom routes as super-admin (in any view), the deleted fields will be processed as in the page-view of normal templates.
Hope this helps. Do let me know.