alexsawallich/alsa-zf-content

该包的最新版本(dev-master)没有提供许可证信息。

一个用于管理内容的ZF2模块。包含后端和前端。

dev-master 2016-03-09 18:33 UTC

This package is auto-updated.

Last update: 2024-08-29 03:42:05 UTC


README

AlsaZfContent 是一个用于 Zend-Framework >= 2 应用的非常简单的内容模块。

它包含一个后端,用于创建、编辑和删除内容项(需要 ZfcAdmin 来配置后端路由)。内容项是一个非常简单的实体,仅由名称、文本正文和发布状态组成。前端唯一的任务是显示一个内容项在一个页面上,包括其名称和文本正文。

依赖项

  • 此模块需要 ZfcAdmin,因为它使用 zfcadmin-路由进行后端。
  • 此模块依赖于 AlsaBase,因为它使用了一些在其中有定义的抽象类。

这些依赖项将由 composer 安装。

安装

  1. 通过 composer 安装 require alexsawallich/alsazfcontent

  2. AlsaZfContent 添加到应用配置文件 config/application.config.php 中的 modules 键。

  3. config/alsazfcontent.global.php.dist 复制到应用的 config/autoload/alsazfcontent.global.php,并根据需要进行调整。

配置

根据需要调整此模块的配置。

<?php
return [
    'alsazfcontent' => [
        /**
         * Name of the class you want to use for content-entities. If you use your
         * own enhanced entity-classes they must extend \AlsaZfCotnent\Entity\Content.
         * 
         * default: '\AlsaZfContent\Entity\Content'
         * 
         * @var string
         */
        'content_entity_name' => \AlsaZfContent\Entity\Content::class,
        
        /**
         * Name of the database-table, where the contents should be stored.
         * 
         * default: content
         * 
         * @var string
         */
        'content_table_name' => 'content',
        
        /**
         * Key of the db-adapter within the service-manager.
         * 
         * default: \Zend\Db\Adapter\Adapter
         * 
         * @var string
         */
        'content_table_adapter_name' => '\Zend\Db\Adapter\Adapter',
    ]
];

杂项

样式

Skeleton Application 类似,此模块使用 Twitter Bootstrap 进行样式设计。如果您在应用中不使用 Twitter Bootstrap,您可能至少需要覆盖前端模板以添加自己的 CSS 类等。

因此,您需要覆盖 view/alsa-zf-content/controller/frontend/view.phtml

翻译

该模块使用英语作为其主要语言。然而,在用户显示字符串的地方,都会考虑到 ZFs 的翻译功能,因为视图中有使用到 translate 视图助手。控制器中的闪存消息以及表单标签也被翻译。因此,您需要在应用的配置文件中设置一个 translator 键。此模块的文本域是 alsazfcontent。目前仅提供德语翻译。您可以将此模块翻译成您的母语并提交一个 pull request。

增强

为了增强功能,您将需要编写自己的模块,这些模块与 AlsaZfContent 交互。因此,AlsZfContent 在特定位置触发事件,这允许您与自己的模块挂钩。