Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Creating a multi step process in admin


Reply


2 Posts   364 Views

Avatar
lozhowlett

Community Member, 146 Posts

23 July 2013 at 5:22am

Hi

I want to create a 3 step process is the admin system, which is going to take some serious customisation.

Step 1: Select venue and enter event details
Step 2: Select dates for the event
Step 3: Select car parks available for event and set pricing

Is this even possible? Thanks

Avatar
ajthenewguy

Community Member, 1 Post

25 July 2013 at 4:15pm

That might actually be pretty easy, just use conditionals on the getCMSFields function, check for fields set, and depending on which ones are already set, present a different set of fields.

$StepOneFields = new CompositeField(
new DropdownField('VenueID', 'Venue', Venu::get()->map())
);

$StepTwoFields = new CompositeField(
new GridField('Dates', 'Dates', $this->Dates())
);

$StepThreeFields = new CompositeField(
new GridField('CarParks', 'Car Parks', CarParks::get()->map())
);

if( !$this->ID ) $fields->addFieldToTab('Root.Main', $StepOneFields);
elseif( $this->ID && $this->VenueID ) $fields->addFieldToTab('Root.Main', $StepTwoFields);
elseif( $this->ID && empty($this->CarParks()) ) $fields->addFieldToTab('Root.Main', $StepThreeFields);
else // Add all 3 CompositeFields to FieldList