I have set up an editable field:
If I look at Publish date under 'Advanced settings' in the Admin Panel I can see the correct date i.e. it is the same as item_date. But when I do <cms:dump/> k_publish_date is empty (k_page_date reflects the date that is entered in to item_date).
I have tried
But that doesn't work either.
I'm assuming that it is important that k_publish_date is set up for sorting etc
Any suggestions?
- Code: Select all
<cms:editable type='datetime' validator='MyDate::set_default_date' name='item_date' format='dmy' default_time='@current' label="Published date" order='11' />
- Code: Select all
class MyDate{
function set_default_date( $field ){
global $FUNCS;
$item_date = trim($field->get_data());
// Set publish_date to value of this field
$f = &$field->siblings[3];
$publish_date = trim( $f->get_data() );
if( $publish_date != '0000-00-00 00:00:00' ){
$item_date = $FUNCS->make_date( $item_date );
if( $publish_date != $item_date ){
$f->store_posted_changes( $item_date );
}
}
unset( $f );
return true;
}
}
If I look at Publish date under 'Advanced settings' in the Admin Panel I can see the correct date i.e. it is the same as item_date. But when I do <cms:dump/> k_publish_date is empty (k_page_date reflects the date that is entered in to item_date).
I have tried
- Code: Select all
<cms:config_form_view>
<cms:persist
k_publish_date="<cms:show item_date />"
_auto_title='1'
/>
</cms:config_form_view>
But that doesn't work either.
I'm assuming that it is important that k_publish_date is set up for sorting etc
Any suggestions?