danyaPostfactum/modx-ace

OnDocFormPrerender Fatal error

Fi1osof opened this issue · 3 comments

Fatal error: Call to a member function get() on a non-object in /var/www/modxshop.webtm.ru/v01/public_html/core/cache/includes/elements/modplugin/1.include.cache.php on line 122

$mimeType = $modx->getObject('modContentType', $modx->controller->resourceArray['content_type'])->get('mime_type');

Error if resource does not exists.

How can we edit a non-existing resource? Do you mean creating new resource? But resourceArray exists in any case, doesn't it?
Anyway, this error occurs on Resource Overview action. What workaround do you offer? check $controller->resourceArray existence ?

I also need to add modContentType object existence check.

Try open non-existsing resource: manager/?a=resource/update&id=999999

I does add checking:
if(!$o = $modx->getObject('modContentType', $modx->controller->resourceArray['content_type'])){
return;
}
$mimeType = $o->get('mime_type');