API: return custom sort types in getConfig

This commit is contained in:
Andrew Dolgov 2021-05-18 16:36:56 +03:00
parent b5a559a1a7
commit 57cd8acfc9
1 changed files with 13 additions and 0 deletions

View File

@ -377,6 +377,7 @@ class API extends Handler {
]; ];
$config["daemon_is_running"] = file_is_locked("update_daemon.lock"); $config["daemon_is_running"] = file_is_locked("update_daemon.lock");
$config["custom_sort_types"] = $this->_get_custom_sort_types();
$config["num_feeds"] = ORM::for_table('ttrss_feeds') $config["num_feeds"] = ORM::for_table('ttrss_feeds')
->where('owner_uid', $_SESSION['uid']) ->where('owner_uid', $_SESSION['uid'])
@ -852,4 +853,16 @@ class API extends Handler {
return false; return false;
} }
private function _get_custom_sort_types() {
$ret = [];
PluginHost::getInstance()->run_hooks_callback(PluginHost::HOOK_HEADLINES_CUSTOM_SORT_MAP, function ($result) use (&$ret) {
foreach ($result as $sort_value => $sort_title) {
$ret[$sort_value] = $sort_title;
}
});
return $ret;
}
} }