mediadreams / md_newsfrontend
This TYPO3 extension enables frontend users to created news records.
Package info
github.com/cdaecke/md_newsfrontend
Type:typo3-cms-extension
pkg:composer/mediadreams/md_newsfrontend
Requires
- georgringer/news: ^11.0 || ^12.0 || ^13.0 || ^14.0
- typo3/cms-core: ^13.4 || ^14.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.28
- friendsofphp/php-cs-fixer: ^3.48
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.0
- rector/rector: ^2.0
- saschaegerer/phpstan-typo3: ^2.1
- ssch/typo3-rector: ^3.0
- tomasvotruba/type-coverage: ^2.0
- typo3/cms-fluid: ^13.4
- typo3/cms-fluid-styled-content: ^13.4 || ^14.0
- typo3/cms-frontend: ^13.4
- typo3/coding-standards: ^0.8
- typo3/testing-framework: ^8.0
This package is auto-updated.
Last update: 2026-04-02 09:46:34 UTC
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.