open20/amos-news

此包的最新版本(1.28.4)没有可用的许可信息。

AMOS新闻系统


README

新闻管理。

安装

您需要在您的配置中要求此包并启用模块。

在 composer.json 中添加到 composer 要求

"open20/amos-news": "dev-master",

或运行命令 bash

composer require "open20/amos-news:dev-master"

在 modules-amos.php 中启用新闻模块,添加

 'news' => [
	'class' => 'open20\amos\news\AmosNews',
 ],

将新闻迁移添加到控制台模块(console/config/migrations-amos.php)

'@vendor/open20/amos-news/src/migrations'

如果您的项目中使用前端或公开网站,并且新闻需要在后台之外可见,则启用表单/向导字段以允许在前端/主页上使用参数发布

'news' => [
        'class' => 'open20\amos\news\AmosNews',
        'params' => [
            'site_publish_enabled' => true,
            'site_featured_enabled' => true
        ]
    ],

内容适合与cwh内容管理一起使用。为此

  • 激活cwh插件
  • 打开cwh配置向导(需要管理员权限) url: /cwh/configuration/wizard
  • 在内容配置部分搜索新闻
  • 编辑新闻配置并保存

如果需要标签,在 "modules-amos.php" 中启用此模块(主项目的 backend/config 文件夹)中的标签部分。之后,在标签管理器中启用树。

如果平台使用报告和/或评论,并且您想启用新闻可以评论/报告内容,请将模型添加到 modules-amos.php 中的配置中

用于报告

 'report' => [
     'class' => 'open20\amos\report\AmosReport',
     'modelsEnabled' => [
        .
        .
        'open20\amos\news\models\News', //line to add
        .
        .
     ]
     ],

用于评论

  'comments' => [
    'class' => 'open20\amos\comments\AmosComments',
    'modelsEnabled' => [
        .
        .
        'open20\amos\news\models\News', //line to add
        .
        .
 	],
  ],

可配置字段

以下是可配置字段列表,AmosNews模块的属性。如果某些属性的默认值不适合您的项目,您可以在模块中配置它,例如

 'news' => [
	'class' => 'open20\amos\news\AmosNews',
	'validatePublicationDate' => false, //changed property (default was true)
 ],
  • validatePublicationDate - 布尔值,默认 = true
    如果此属性为true,则激活发布日期的验证。
    默认情况下,您只能验证发布日期大于或等于今天的新闻。
    设置为false以允许对发布日期小于今天的新闻进行验证。

  • filterCategoriesByRole - 布尔值,默认 = false
    如果为true,则通过news_category_roles_mm表启用类别角色的检查。
    默认情况下,新闻类别对所有用户都可用。
    如果类别与rbac角色关联,请填充'news_category_roles_mm'表,并在配置中将模块属性filterCategoriesByRole设置为true

    'news' => [
      'class' => 'open20\amos\news\AmosNews',
      'filterCategoriesByRole' => true
    ]
  • hidePubblicationDate - 布尔值,默认 = false
    创建的新闻总是可见的,隐藏字段publication_from、publication_to

  • newsRequiredFields - 数组,默认 = ['news_categorie_id', 'titolo', 'status', 'descrizione_breve']
    新闻表单中的必填字段:默认情况下,新闻类别、标题和状态是必填的。
    如果您的平台中,例如,您不希望标题是必填字段,则按以下方式覆盖newsRequiredFields属性

'news' => [
    'class' => 'open20\amos\news\AmosNews',
    'newsRequiredFields' => ['news_categorie_id', 'status']  
],
  • defaultCategory - 整数 默认选择的新闻的类别ID
'news' => [
    'class' => 'open20\amos\news\AmosNews',
    'defaultCategory' => 3  
],
  • autoUpdatePublicationDate - 布尔值,默认 = false
    如果新闻已发布,则设置自动更新发布日期
'news' => [
    'class' => 'open20\amos\news\AmosNews',
    'autoUpdatePublicationDate' => true
],
  • $enableCategoriesForCommunity - 布尔值,默认 = false
  • $showAllCategoriesForCommunity - 布尔值,默认 = false
  • $whiteListRolesCategories - 默认 = ['ADMIN', 'BASIC_USER']