Closed mzur closed 8 years ago
Almost 1 year later I'm happy to tell you that this has finally arrived in the develop branch :)
You can now change the default parameters for the slug method like this:
str::$defaults['slug'] = [
'separator' => '-',
'allowed' => 'a-z0-9_'
];
I will probably also add this as official kirby options.
I'm currently having a discussion with aftereffectsmagic on how to implement the calendar plugin using subpages as events instead of a structure field.
This works really well with one exception: The calendar plugin requires an event to have a
_begin_date
field (there can be others like_begin_time
, too). The_
prefix marks them as immutable fields of the plugin. The snake case format was chosen because the panel converts all keys to lower case.While this works fine using a structure field containing all events, it breaks when each event should be represented by a subpage. This is because of the
str::slug
method stripping all page field keys of any character other thana-z0-9
, which includes the_
.Since strings containing
_
are valid PHP variable names (for page field accessors like$page->_begin_date()
) as well as valid URLs, I'm now creating this pull request adding_
to the allowed characters ofstr:slug
to fix this issue.