Add to trigger for notice list

This commit is contained in:
BJRambo 2020-12-24 18:43:15 +09:00
parent 5d39fe938a
commit dab51ba48e

View file

@ -304,7 +304,26 @@ class documentModel extends document
$args = new stdClass();
$args->module_srl = $obj->module_srl;
$args->category_srl = $obj->category_srl ?? null;
$output = executeQueryArray('document.getNoticeList', $args, $columnList);
// Call trigger (before)
// This trigger can be used to set an alternative output using a different search method
unset($obj->use_alternate_output);
$output = ModuleHandler::triggerCall('document.getNoticeList', 'before', $obj);
if ($output instanceof BaseObject && !$output->toBool())
{
return $output;
}
// If an alternate output is set, use it instead of running the default queries
if (isset($obj->use_alternate_output) && $obj->use_alternate_output instanceof BaseObject)
{
$output = $obj->use_alternate_output;
}
else
{
$output = executeQueryArray('document.getNoticeList', $args, $columnList);
}
if(!$output->toBool() || !$result = $output->data)
{
return;
@ -322,7 +341,10 @@ class documentModel extends document
$output->data[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
}
self::setToAllDocumentExtraVars();
// Call trigger (after)
// This trigger can be used to modify search results
ModuleHandler::triggerCall('document.getNoticeList', 'after', $output);
return $output;
}