Commit 5b698d60 authored by Frank Wall's avatar Frank Wall Committed by Franco Fichtner

ModelRelationField: soft-fail on missing classes

(cherry picked from commit ba90a39f)
parent 470ff4bb
...@@ -85,6 +85,10 @@ class ModelRelationField extends BaseField ...@@ -85,6 +85,10 @@ class ModelRelationField extends BaseField
// only handle valid model sources // only handle valid model sources
if (isset($modelData['source']) && isset($modelData['items']) && isset($modelData['display'])) { if (isset($modelData['source']) && isset($modelData['items']) && isset($modelData['display'])) {
$className = str_replace(".", "\\", $modelData['source']); $className = str_replace(".", "\\", $modelData['source']);
// handle optional/missing classes, i.e. from plugins
if (!class_exists($className)) {
continue;
}
$modelObj = new $className; $modelObj = new $className;
foreach ($modelObj->getNodeByReference($modelData['items'])->__items as $node) { foreach ($modelObj->getNodeByReference($modelData['items'])->__items as $node) {
$displayKey = $modelData['display']; $displayKey = $modelData['display'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment