Skip to content

Commit

Permalink
Add details slug field
Browse files Browse the repository at this point in the history
  • Loading branch information
texnixe committed Nov 18, 2023
1 parent f9b14f4 commit 7b54a23
Showing 1 changed file with 37 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ fields:

(field-options: slug)

## How to use in templates/snippets

```php
<div class="<?= $page->className() ?>">
<!-- -->
</div>
```

## Sync option

You can sync the slug field with another field. Whenever the editor types something into the synced field, the slug field will update with a sluggified version of the input:
Expand All @@ -48,7 +40,21 @@ fields:
type: slug
sync: title
```
<info>
Please note that when your field to sync uses camelCase, you still have to reference the field with all lowercase letters:

```yaml
fields:
sectionHeadline:
type: text
id:
label: Id
type: slug
sync: sectionheadline
```

The same applies for the `wizard` option below.
</info>

## Wizard option

Expand Down Expand Up @@ -78,3 +84,26 @@ fields:
sync: title
allow: _
```

<info>
The slug field also works within blocks or structure field items to sync fields within a block/structure field item.
```yaml
fields:
structure:
type: structure
fields:
text:
type: text
slug:
type: slug
sync: text
</info>


## How to use in templates/snippets

```php
<div class="<?= $page->className() ?>">
<!-- -->
</div>
```

0 comments on commit 7b54a23

Please sign in to comment.