umanit/content-publication-bundle
最新稳定版本:1.0.3
Composer 安装命令:
composer require umanit/content-publication-bundle
包简介
A simple yet efficient publishing bundle.
README 文档
README
A simple yet efficient publishing bundle.
Install
Register the bundle to your 'app/AppKernel.php'
new Umanit\ContentPublicationBundle\UmanitContentPublicationBundle(),
Usage
Make your entity publishable
Implement the interface PublishableInterface and use the trait PublishableTrait.
<?php namespace App\Entity\Content; use Doctrine\ORM\Mapping as ORM; use Umanit\ContentPublicationBundle\Doctrine\Model\PublishableInterface; use Umanit\ContentPublicationBundle\Doctrine\Model\PublishableTrait; #[ORM\Table(name: 'news')] #[ORM\Entity] class News implements PublishableInterface { use PublishableTrait; }
This will add two fields to your entity, publishDate and unpublishDate.
All your content will then be displayed only when the current datetime is between those fields.
(Optional) Disable the filter for a specific firewall
Usually you'll need to administrate your contents.
For doing so, you can disable the filter by configuring the disabled_firewalls option.
# config/packages/umanit_content_publication.yaml umanit_content_publication: disabled_firewalls: ['admin']
To follow this example, you'll need to add the admin firewall to your `security.yml file.
Check out the Symfony documentation for more details.
统计信息
- 总下载量: 1.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-21