you could use a aftergetfields - hook - snippet
with
if ($object) {
$record_fields = $object->get('record_fields');
$year = $object->get['year'];
$record_fields['year'] = empty($year) ? date('Y') : $year;
$object->set('record_fields',$record_fields);
}
return '';
[ed. note: Bruno17 last edited this post 11 years, 3 months ago.]
Thanks -
I couldn't get that snippet to run properly. I dumped the $records in 'processors/mgr/default/fields.php' and the 'year' field had been set. But, it didn't display in the input box or get saved to the database when I saved the entry with the year field empty.
Using the @CHUNK does work - so I am not too concerned.
Michael Regan
TIMR Web Services
Phone: 250.218.5284
Eamil:
[email protected]
Website: timr.ca
there was a mistake in the snippet.
This was wrong:
$year = $record->get['year'];
needs to be
$year = $object->get['year'];