mediadreams/md_newsfrontend

This TYPO3 extension enables frontend users to created news records.

Installs: 4 280

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 4

Forks: 3

Open Issues: 4

Language:JavaScript

Type:typo3-cms-extension

4.0.0 2024-02-02 10:15 UTC

This package is auto-updated.

Last update: 2024-02-02 10:20:00 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 >= 11.5
  • ext:news >= 9.0

Installation

  • Install the extension by using the extension manager or use composer
  • Include the static TypoScript of the extension
  • Configure the extension by setting your own constants

Usage

  • Add the pluign News frontend on 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\CreateActionBeforeSave: Called just before saving a new record
  • Mediadreams\MdNewsfrontend\Event\CreateActionAfterPersist: Called after a new record was saved (new record Id is available)
  • Mediadreams\MdNewsfrontend\Event\UpdateActionBeforeSave: Called just before an existig record will be updated
  • Mediadreams\MdNewsfrontend\Event\DeleteActionBeforeDelete: Called just before a record will be deleted

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();
    }
}

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.