Hi
I would like to store some arrays which I can call from any page type and DataObject.
The arrays are just to populate dropdown elements in the CMS.
Here is some example DataObject code which uses an array inside the DataObject:
class TripDay extends DataObject {
static $db = array(
'Day' => 'Text',
'DaySum' => 'Text',
'DayDesc' => 'Text'
);
static $has_one = array(
'TripPages' => 'TripPage'
);
function getCMSFields_forPopup() {
$f = new FieldSet();
$weekdays = array(
'' => '(Please Select)',
'Monday' => 'Monday',
'Tuesday' => 'Tuesday',
'Wednesday' => 'Wednesday',
'Thursday' => 'Thursday',
'Friday' => 'Friday',
'Saturday' => 'Saturday',
'Sunday' => 'Sunday'
);
$f->push( new DropdownField('Day', 'Day of week', $weekdays) );
$f->push( new TextField( 'DaySum', 'Summary of day' ) );
$f->push( new TextAreaField('DayDesc', 'Full description', '15' ) );
return $f;
}
}
This works great but I would like to access this array and others from other DataObjects and Page types.
What would be a good way to do that?