mediadreams/md_newsfrontend
Composer 安装命令:
composer require mediadreams/md_newsfrontend
包简介
This TYPO3 extension enables frontend users to created news records.
README 文档
README
This extension enables a frontend user to add ext:news-records. Beside adding content for the normal text fields like title, teaser, bodytext it is also possible to upload an image and a file download as well as selecting a category.
Templates are ready to use with the bootstrap framework and icons will be shown, if you have Font Awesome icon set included in your project. Validation of input is done in the frontend, rich text editing enabled for the textarea and a date picker in place for the archive date.
Requirements
- TYPO3 ^13.4 || ^14.0
- ext:news ^11.0 || ^12.0 || ^13.0 || ^14.0
Installation
- Install the extension via Composer or the Extension Manager
- Add the Site Set "News Frontend" (
mediadreams/md-newsfrontend) to your site configuration (config/sites/<yoursite>/config.yaml) - Configure the extension settings directly in the site configuration GUI or via
settings.yaml
Important: If a TypoScript template record exists on your root page, make sure the checkboxes "Clear constants" and "Clear setup" are unchecked. When checked, they wipe all TypoScript loaded by Site Sets before the template record is processed, which results in empty extension settings.
Legacy TypoScript include
If you prefer the classic approach, you can still include the TypoScript manually from EXT:md_newsfrontend/Configuration/TypoScript/ and override constants as needed.
Usage
- Add the pluign
News frontendon a page, which is restricted by the frontend user login - Select a storage page in the plugin-tab in the field
Record Storage Page - Now a frontend user is able to add, edit and delete own records
PSR-14 Events
Following PSR-14 events are available:
Mediadreams\MdNewsfrontend\Event\CreateActionBeforeSaveEvent: Called just before saving a new recordMediadreams\MdNewsfrontend\Event\CreateActionAfterPersistEvent: Called after a new record was saved (new record Id is available)Mediadreams\MdNewsfrontend\Event\UpdateActionBeforeSaveEvent: Called just before an existing record will be updatedMediadreams\MdNewsfrontend\Event\DeleteActionBeforeDeleteEvent: Called just before a record will be deletedMediadreams\MdNewsfrontend\Event\ModifyAllowedMimeTypesEvent: Called during file upload validation to modify the allowed MIME types for a given file extension
Register an event
Add following lines in Configuration/Services.yaml of your own extension:
services: Vendor\Extension\EventListener\MyListener: tags: - name: event.listener identifier: 'ext-mdnewsfrontend/createActionBeforeSaveEvent' method: 'enrichNews' event: Mediadreams\MdNewsfrontend\Event\CreateActionBeforeSaveEvent
Add the class Vendor\Extension\EventListener\MyListener with the method enrichNews in your extension:
namespace Vendor\Extension\EventListener; use Mediadreams\MdNewsfrontend\Event\CreateActionBeforeSaveEvent; final class MyListener { public function enrichNews(CreateActionBeforeSaveEvent $obj) { // Get news object $news = $obj->getNews(); $news->setTeaser('Set some teaser...'); // Get NewsController $newsController = $obj->getNewsController(); } }
ModifyAllowedMimeTypesEvent
The ModifyAllowedMimeTypesEvent is dispatched during file upload validation and allows you to extend or override the built-in MIME type map. This is useful when you need to permit file extensions that are not covered by the default configuration (e.g. svg, heic, odt).
The event provides the following methods:
getExtension(): string— the file extension being validated (lowercase, e.g.'svg')getMimeTypes(): array— the current list of allowed MIME types for this extensionsetMimeTypes(array $mimeTypes): void— replace the entire list of allowed MIME typesaddMimeType(string $mimeType): void— append a single MIME type to the existing list
Example: Allow SVG uploads by adding a listener in Configuration/Services.yaml:
services: Vendor\Extension\EventListener\AddSvgMimeType: tags: - name: event.listener identifier: 'my-extension/add-svg-mime-type' event: Mediadreams\MdNewsfrontend\Event\ModifyAllowedMimeTypesEvent
namespace Vendor\Extension\EventListener; use Mediadreams\MdNewsfrontend\Event\ModifyAllowedMimeTypesEvent; final class AddSvgMimeType { public function __invoke(ModifyAllowedMimeTypesEvent $event): void { if ($event->getExtension() === 'svg') { $event->setMimeTypes(['image/svg+xml']); } } }
Note: Extensions not present in the MIME type map skip the MIME check entirely. To enforce MIME validation for a new extension, add it via this event. To disable MIME validation for an existing extension, call
$event->setMimeTypes([])for that extension.
Bugs and Known Issues
If you find a bug, it would be nice if you add an issue on Github.
THANKS
Thanks a lot to all who make this outstanding TYPO3 project possible!
Credits
- Extension icon was copied from ext:news and enriched with a pen from Font Awesome.
- Thanks to Parsley.js, which I use for validating the form in the frontend.
- Thanks to tiny, which I use as rich text editor in the frontend.
- Thanks to flatpickr, which I use as date picker in the frontend.
- And last but not least thanks to the guys at jQuery.
mediadreams/md_newsfrontend 适用场景与选型建议
mediadreams/md_newsfrontend 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 8.68k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2019 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「extension」 「news」 「frontend」 「typo3」 「fe_users」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mediadreams/md_newsfrontend 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mediadreams/md_newsfrontend 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mediadreams/md_newsfrontend 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Query filtering in your frontend
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
UI Kit 3 Extension for Yii2
Adds more BBCode
统计信息
- 总下载量: 8.68k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2019-04-15