-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update slug generatorOptions fields #854
Update slug generatorOptions fields #854
Conversation
- Explain how the array is used (in the second paragraph). - Explain how the simple array is resolved - If a simple array is used in the examples, also show the variant with the nested array - In the examples, use nav_title, title if they should be used as "either or" because that makes more sense for the examples given - Start the examples with the more simple cases of "either or", not concatenation In the description, we assume a multi-dimensional array and treat the simple array as a special case (which can be resolved to a multi-dimensional array as well). Resolves: #244
@@ -20,34 +20,42 @@ generatorOptions | |||
|
|||
Insert several field names (of type string) that will be considered during slug construction. | |||
|
|||
Can also be used as nested array to combine multiple fields :php:`[['nav_title', 'title'], 'other_field']`. | |||
In the *two-dimensional array*, elements of the first level will be concatenated, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence is hard to understand, at least for me. I has to read it multiple times. What is a two-dimensional array in this scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a two-dimensional array in this scope?
a multidimensional array with 2 levels, or for our special case: array<array<int,string>>
$a = ['a', 'b'];
is simple array with one level (1 array)
$a = [['a'], ['b']]; is multidimensional array with 2 levels ("an array of arrays")
I don't know how else to say it.
So, is this a common term?
If we compare terminology with PHP docs, this is also used here:
"multidimensional array"
https://www.php.net/manual/en/language.types.array.php
Did not find "Two-dimensional array" in official PHP docs, but for example here: https://www.w3schools.com/PHP/php_arrays_multidimensional.asp
But, if is not easily understandable, maybe there is a better way to explain it.
Main intention is to find an explanation for how the values are interpreted.
What I am missing in the current version is exactly this. You can deduce it from the examples. But we have currently a pretty vague introduction:
Insert several field names (of type string) that will be considered during slug construction.
Can also be used as nested array to combine multiple fields [['nav_title', 'title'], 'other_field'].
It is then made clearer in the Info section, but not really enough: Why would inserting multiple fields in a simple array result in a concatenated slug?
I first found current description confusing until I understood how it works. (I did deduce it mostly from the examples but had to look in the source code to understand behaviour of the "simple array").
Alternative: we could leave it as is and let examples speak for themselves. That is preferably, if we are only half happy with current patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the sentence is really hard to grasp for me. I value your intention. Also I stumbled upon "first level" and "second level" (which are not explained).
Maybe something like this:
--- start ---
A slug can consist of multiple levels, for example, the first level can be the page title and the second can be another field:
page-title-other-field
Here "page-title" is the first level and "other-field" is the second level. This is defined as ['title', 'other_field']
The first level can also be an array, like "['nav_title', 'title'], the generator option is then: [['nav_title', 'title'], 'other_field'].
.... and so on ....
--- end ---
That may be better understandable. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the level of nesting in the array. The suggestion does not convey my original intention.
I wanted to sleep on it a bit. I will look at it again later today or weekend and hopefully we can find a solution which works.
Documentation/ColumnsConfig/Type/Slug/Properties/GeneratorOptions.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Chris Müller <[email protected]>
I created another PR #868 changing only the examples. I copied the examples from the changelog https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/9.5.x/Feature-87085-FallbackOptionsForSlugFields.html?highlight=generatoroptions |
In the description, we assume a multi-dimensional array and treat the simple array as a special case (which can be resolved to a multi-dimensional array as well).
Resolves: #244