README.md 1.29 KB
Newer Older
Thomas Löffler's avatar
Thomas Löffler committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
# TYPO3 extension "slug_extbase"

## What does it do?

In general, the slug field is updated on every change in backend or via DataHandler.<br>
But using forms in frontend to change Extbase models doesn't have an effect on the slug field.

This extensions provides an interface to use in your Extbase model.<br>
With a proper TCA configuration it automatically updates the slug field if one of the configured
table fields was changed.

## Installation

### Via composer

1. `composer require spooner-web/slug-extbase`

### Via Extension Manager

1. Download the extension from TER or inside EM
1. Activate the package

## Usage

Add the provided interface `\SpoonerWeb\SlugExtbase\SlugEntityInterface` to your Extbase model, e.g.

```php

class MyModel extends TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements \SpoonerWeb\SlugExtbase\SlugEntityInterface

```

That's it.

Okay, you need a slug field in database and the [TCA configuration](https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/Slug.html) for it as well.

Whenever you create or update an Extbase model via a frontend form, the magic happens and the slug field 
will be updated like you configured it. 
Thomas Löffler's avatar
Thomas Löffler committed
39 40 41 42

## Kudos

Thanks to [12bis3](https://www.12bis3.de) for the ideas to use interfaces and for the automatic slug update!