Hi there,
I was wondering which method to add custom fields in admin area is the best or maybe that depends on something?
Method 1:
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', new TextField('MyTextField'));
$fields->addFieldToTab('Root.Main', new TextareaField('MyTextareaField'));
return $fields;
Method 2:
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.FleetPreview', TextField::create(‘MyTextField’));
$fields->addFieldToTab('Root.FleetPreview', TextareaField::create(‘MyTextareaField’));
return $fields;
Method 3:
function getCMSFields() {
$fields = FieldList::create(
TextField::create(‘MyTextField’),
TextareaField::create(‘MyTextareaField’)
);
return $fields;
What are the real differences besides syntax ?
Cheers,
Darek.