Merge branch 'dev' of gitee.com:zongzhige/shopxo into dev

This commit is contained in:
Devil 2021-08-25 11:00:24 +08:00
commit e43fe7ae0a
2 changed files with 44 additions and 2 deletions

View File

@ -89,8 +89,9 @@ class Article extends Common
{
MyViewAssign('home_seo_site_description', $ret['data'][0]['seo_desc']);
}
MyViewAssign('article', $ret['data'][0]);
$article = $ret['data'][0];
$this->PluginsHook($id, $article);
MyViewAssign('article', $article);
return MyView();
}
@ -98,5 +99,33 @@ class Article extends Common
MyViewAssign('msg', '文章不存在或已删除');
return MyView('public/tips_error');
}
/**
* 钩子处理
* @author whats
* @blog
* @version 1.0.0
* @date 2019-04-22
* @desc description
* @param [int] $article_id [文章id]
* @param [array] $params [输入参数]
*/
private function PluginsHook($article_id, &$article)
{
$hook_arr = [
//文章内容内部钩子
'plugins_view_article_detail_content_within',
];
foreach($hook_arr as $hook_name)
{
MyViewAssign($hook_name.'_data', MyEventTrigger($hook_name,
[
'hook_name' => $hook_name,
'is_backend' => false,
'article_id' => $article_id,
'article' => &$article,
]));
}
}
}
?>

View File

@ -25,6 +25,19 @@
<hr class="am-article-divider" />
</div>
<div class="am-article am-scrollable-horizontal">{{$article.content|raw}}</div>
<!-- 文章详情内部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div class="plugins-tag">
<span>plugins_view_article_detail_content_within</span>
</div>
{{/if}}
{{if !empty($plugins_view_article_detail_content_within_data) and is_array($plugins_view_article_detail_content_within_data)}}
{{foreach $plugins_view_article_detail_content_within_data as $hook}}
{{if is_string($hook) or is_int($hook)}}
{{$hook|raw}}
{{/if}}
{{/foreach}}
{{/if}}
</div>
<!-- 左侧内容 -->