api: get flavor image from plugin-processed content

This commit is contained in:
Andrew Dolgov 2021-02-15 08:28:46 +03:00
parent 3c584376ca
commit a4604e892c
1 changed files with 14 additions and 11 deletions

View File

@ -778,20 +778,23 @@ class API extends Handler {
$hook_object = ["headline" => &$headline_row]; $hook_object = ["headline" => &$headline_row];
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API, if ($show_content) {
function ($result) use (&$headline_row) { PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API,
$headline_row = $result; function ($result) use (&$headline_row) {
}, $headline_row = $result;
$hook_object); },
$hook_object);
list ($flavor_image, $flavor_stream, $flavor_kind) = Article::get_article_image($enclosures, $line["content"], $line["site_url"]); list ($flavor_image, $flavor_stream, $flavor_kind) = Article::get_article_image($enclosures,
$headline_row["content"], $line["site_url"]);
$headline_row["flavor_image"] = $flavor_image; $headline_row["flavor_image"] = $flavor_image;
$headline_row["flavor_stream"] = $flavor_stream; $headline_row["flavor_stream"] = $flavor_stream;
/* optional */ /* optional */
if ($flavor_kind) if ($flavor_kind)
$headline_row["flavor_kind"] = $flavor_kind; $headline_row["flavor_kind"] = $flavor_kind;
}
array_push($headlines, $headline_row); array_push($headlines, $headline_row);
} }