Skip to content

Commit c44c6eb

Browse files
committed
Add info on how to prevent validation being added.
Closes #26
1 parent 35503ca commit c44c6eb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ Slug comes with the following configuration options:
8080
- `unique:`: tells if slugs should be unique. Set this to a callable if you
8181
want to customize how unique slugs are generated. Defaults to `true`.
8282
- `scope`: extra conditions used when checking a slug for uniqueness.
83-
- `implementedEvents`: events this behavior listens to.
83+
- `implementedEvents`: events this behavior listens to. Defaults to
84+
`['Model.buildValidator' => 'buildValidator', 'Model.beforeSave' => 'beforeSave']`.
85+
By default the behavior adds validation for the `displayField` fields to make
86+
them required on record creating. If you don't want these auto added validations
87+
you can set `implementedEvents` to just `['Model.beforeSave' => 'beforeSave']`.
8488
- `onUpdate`: Boolean indicating whether slug should be updated when updating
8589
record, defaults to `false`.
8690

src/Model/Behavior/SlugBehavior.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ class SlugBehavior extends Behavior
3535
* - unique: Tells if slugs should be unique. Set this to a callable if you
3636
* want to customize how unique slugs are generated. Defaults to `true`.
3737
* - scope: Extra conditions used when checking a slug for uniqueness.
38-
* - implementedEvents: Events this behavior listens to.
38+
* - implementedEvents: Events this behavior listens to. Defaults to
39+
* `['Model.buildValidator' => 'buildValidator', 'Model.beforeSave' => 'beforeSave']`.
40+
* By default the behavior adds validation for the `displayField` fields
41+
* to make them required on record creating. If you don't want these auto
42+
* added validations you can set `implementedEvents` to just
43+
* `['Model.beforeSave' => 'beforeSave']`.
3944
* - onUpdate: Boolean indicating whether slug should be updated when
4045
* updating record, defaults to `false`.
4146
*

0 commit comments

Comments
 (0)