FIX: Ensuring custom CMS validator uses Object->hasMethod() to respect extension decorator pattern.

This commit is contained in:
Patrick Nelson 2015-02-25 14:11:12 -05:00
parent fcf0e8980a
commit f5f41b2f0e

View File

@ -95,7 +95,7 @@ class GridFieldDetailForm implements GridField_URLHandler {
// if no validator has been set on the GridField and the record has a
// CMS validator, use that.
if(!$this->getValidator() && method_exists($record, 'getCMSValidator')) {
if(!$this->getValidator() && (method_exists($record, 'getCMSValidator') || $record instanceof Object && $record->hasMethod('getCMSValidator'))) {
$this->setValidator($record->getCMSValidator());
}