arter / amos-comments
此包最新版本(1.3.3)没有可用的许可证信息。
内容评论 - 插件
1.3.3
2022-05-16 12:21 UTC
Requires
- php: >=5.4.0
- arter/amos-admin: ^2.0
- arter/amos-attachments: ^1.1.9
- arter/amos-core: ^1.20.2
This package is auto-updated.
Last update: 2024-09-16 19:46:15 UTC
README
新闻、事件等内容评论的扩展...
安装
1 安装此扩展的首选方式是通过 composer。
运行以下命令:
composer require arter/amos-comments
或者将以下行添加到你的 composer.json
文件的 require 部分。
"arter/amos-comments": "dev-master"
to the require section of your composer.json
file.
2 将模块添加到后端主配置
<?php
'modules' => [
'comments' => [
'class' => 'arter\amos\comments\AmosComments',
'modelsEnabled' => [
/**
* Add here the classnames of the models where you want the comments
* (i.e. 'arter\amos\events\models\Event')
*/
],
// the following are mandatory fields
'displayNotifyCheckbox' => true, // if the notify checkbox in the accordion must be shown (if hidden, the notify checkbox is selected)
'accordionOpenedByDefault' => false, // if the accordion must be opened by default
],
],
此外,将这些行添加到你的 bootstrap
<?php
'bootstrap' => [
'comments',
],
3 将视图组件添加到主配置中的 common
<?php
'components' => [
'view' => [
'class' => 'arter\amos\core\components\AmosView',
],
],
4 应用迁移
php yii migrate/up --migrationPath=@vendor/arter/amos-comments/src/migrations
或者将以下行添加到控制台的迁移配置中
<?php
return [
'@vendor/arter/amos-comments/src/migrations',
];
5 在你的模型中实现 CommentInterface
<?php
use arter\amos\comments\models\CommentInterface;
/**
* Implement the CommentInterface
*/
class MyClass implements CommentInterface
/**
* Add the required method that must return boolean
*/
public function isCommentable()
{
return true;
}
6 将你的模型添加到后端配置中的 modulesEnables
<?php
'modules' => [
'comments' => [
'class' => 'arter\amos\comments\AmosComments',
'modelsEnabled' => [
'class_namespace\MyClass'
]
],
],
7 禁用邮件通知
<?php
'modules' => [
'comments' => [
'class' => 'arter\amos\comments\AmosComments',
'enableMailsNotification' => false,
'modelsEnabled' => [
'class_namespace\MyClass'
]
],
],
*htmlMailContent - 字符串/数组
当你插入评论时更改通知邮件的内容,可以插入一个数组
'comments' => [
'htmlMailContent' => [
'arter\amos\news\models\News' => '@backend/mail/comment/content_news',
'arter\amos\discussioni\models\DiscussioniTopic' => '@backend/mail/comment/content_discussioni',
'arter\amos\documenti\models\Documenti' => '@backend/mail/comment/content_documenti'
],
或者一个字符串,如果内容对所有内容(新闻/讨论/文档等)都有效
'comments' => [
'htmlMailContent' => '@backend/mail/comment/content_news'
]
启用CommentInterface *enableCommentOnlyWithScope - 布尔值,默认为 false
如果为 true,则仅启用具有作用域(在社区中)的评论
'comments' => [
'enableCommentOnlyWithScope' => true,
]