@aleks, I had some time to test your code. Here is what I found -
Firstly, there is no need in config_form_view's styling (especially placed within another editable!!) - you may see in my sample a deliberately emptied and self-closed tag <cms:config_form_view />, because of 2 reasons - first, styling needed for the older version of CouchCMS - before datetime editable had a parameter only_time='1', second, CouchCMS has a known and waiting to be fixed bug that keeps config_form_view's data in db if it was removed with data from a page without being emptied first ("no tag -> no handling" issue).
Secondly, the rest of the code is fine and the problem with date output is another CouchCMS's oversight. I will leave it for @KK to fix it permanently and apply his desired styling of the code, but after some debugging I can suggest a temporary and safe fix. Please navigate to file /couch/addons/mosaic/theme/fields/ctx-setters.php and after the curly brace of the block ends around line 50, paste my fix to make the final result look as follows (with the previous block shown for simplicity) -
Does it help?
Firstly, there is no need in config_form_view's styling (especially placed within another editable!!) - you may see in my sample a deliberately emptied and self-closed tag <cms:config_form_view />, because of 2 reasons - first, styling needed for the older version of CouchCMS - before datetime editable had a parameter only_time='1', second, CouchCMS has a known and waiting to be fixed bug that keeps config_form_view's data in db if it was removed with data from a page without being emptied first ("no tag -> no handling" issue).
Secondly, the rest of the code is fine and the problem with date output is another CouchCMS's oversight. I will leave it for @KK to fix it permanently and apply his desired styling of the code, but after some debugging I can suggest a temporary and safe fix. Please navigate to file /couch/addons/mosaic/theme/fields/ctx-setters.php and after the curly brace of the block ends around line 50, paste my fix to make the final result look as follows (with the previous block shown for simplicity) -
- Code: Select all
// Append time? if( $f->allow_time ){ $h = substr( $date, 11, 2 ); $m = substr( $date, 14, 2 ); if( $f->am_pm ){ // 24-hour time to 12-hour time list( $h, $m, $a ) = explode( ":", @date("h:i:A", strtotime("$h:$m")) ); $formatted_date .= "@ $h:$m $a"; } else{ $formatted_date .= "@$h:$m"; } } // "Only time" temp fix by @trendoman if( $f->only_time ){ $h = substr( $date, 11, 2 ); $m = substr( $date, 14, 2 ); if( $f->am_pm ){ // 24-hour time to 12-hour time list( $h, $m, $a ) = explode( ":", @date("h:i:A", strtotime("$h:$m")) ); $formatted_date = "$h:$m $a"; } else{ $formatted_date = "$h:$m"; } } $CTX->set( 'k_date_formatted', $formatted_date ); } }
Does it help?