Taitava\CMSEditLink\CMSLinkScaffolder::PickModelAdmin
Searches all ModelAdmin classes and tries to find a one which can manage the passed $data_object. If the DataObject has defined a method named `getModelAdminForCMSEditLink()`, then we will use exactly the ModelAdmin returned by that method (but we still do strict checking for the returned ModelAdmin to ensure that it really can manage the passed $data_object). `getModelAdminForCMSEditLink()` may return either a string representing a ModelAdmin class name, or an instance of a ModelAdmin class.
If the method cannot find a suitable ModelAdmin class, it will throw either an Exception or UnexpectedValueException.
Signature
private function PickModelAdmin(DataObject
$data_object,
string&
$managed_data_object_class )
Parameters
$data_object
— SilverStripe\ORM\DataObject
$managed_data_object_class
— string- This variable will be set to contain the exact DataObject class name which matched with the managed model names of the returned ModelAdmin. An example: DataObjects can be extended from parent DataObjects, which means that a ModelAdmin which is able to manage SiteTree objects, is also able to manage Page objects. If $data_object is an instance of Page, and the ModelAdmin is defined to manage SiteTrees, then the generated link URL must contain 'SiteTree' as a class name instead of 'Page'. This is why return a DataObject class name too.
Returns
- ModelAdmin