This repository was archived by the owner on Jan 25, 2021. It is now read-only.
Allow '_' as a valid character for str::slug.#91
Closed
mzur wants to merge 1 commit intogetkirby-v2:developfrom
mzur:develop
Closed
Allow '_' as a valid character for str::slug.#91mzur wants to merge 1 commit intogetkirby-v2:developfrom mzur:develop
mzur wants to merge 1 commit intogetkirby-v2:developfrom
mzur:develop
Conversation
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_datefield (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::slugmethod 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:slugto fix this issue.