-
-
Save kinglozzer/3844f78dbdb99fe41972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyDataObject extends DataObject { | |
public function getCMSFields() { | |
$fields = parent::getCMSFIelds(); | |
$clientSource = function() { | |
return Client::get()->map('ID', 'ClientName'); | |
}; | |
$clientIDField = new DropdownField('ClientID', 'Client', $clientSource()); | |
$clientIDField->useAddNew('Client', $clientSource); | |
$fields->addFieldToTab('Root.Foo', $clientIDField); | |
return $fields; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment