-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
Modded core's select field to accommodate for multiple contenttypes. #6270
Modded core's select field to accommodate for multiple contenttypes. #6270
Conversation
Can you make this PR against |
Like magic 😉 |
Ok, gawain magic made it against |
Just needs a rebase … call out if you need help with that. |
@GawainLynch Rebased on to 3.3 and pushed. Some other file changes got flagged so undid those and pushed again. What's caused all the conflicting files :/ ? |
32069fb
to
4ab588d
Compare
For the future (4.0 I guess) I think we should standardize this to one format. Having the field return completely differently formatted values for |
Also, from what I can see from the docs (and from memory) the fieldnames (what comes after the slash) was never meant to be more than presentational, ( https://docs.bolt.cm/3.2/fields/select#populating-the-values-from-a-contenttype ), so having them determine functionality is a bit odd since |
@SahAssar you're right, the right hand side should only be for presentation reasons. How about instead of determining the value format from the presence of |
@mrenigma Well, the base problem is that we have crammed so much functionality into the select fieldtype that it's getting hard to manage. Adding yet another format to both the config and values seems to me like it's handing all of us another (though very attractive, useful and wanted, but still) footgun. I'd prefer if this was spun off as a separate fieldtype (still in core) called EDIT: It'd also ease getting some order into the select fieldtype template, which is sortof a mess. |
@SahAssar Being devils advocate here - you could just make the select field always save as If it is split off, I would propose simplifying the select field to only static arrays of either values or key/value pairs and then move all the contenttype search functionality over to the new |
Also worth saying that if in 4.0 everyone has to rename some of their config fields from |
@mrenigma Well, we could if we were willing to break backwards compatibility in a minor version, as it stands now the select field must be able to accept to values/configs it has during 3.X, until we release 4.X. The split off basically makes it so that we can force the My biggest issues with the select field is that
So basically everything can change, but still be called the same field. If that same philosophy was used for other fields text, textarea, hidden, wysiwyg and markdown would all be one fieldtype called But don't take my word for it until some other folks have chimed in, this is just my opinion 😄 |
OK, called good to go at tonight's meeting. |
This modification allows core's select fields to handle multiple content types. This is already possible within the codebase because
value
is applied directly to thesetcontent
call in the_select.twig
template. Therefore the first part ofvalue
could have any validsetcontent
input. It just didn't work because the existing select field combined all the ID's.This small change works by checking for the existence of
contenttype
and if it exists, prepending it to the output text and also prepending it to the output values. This will work for singular or multiple content type combinations and has no effect on existing select fields as before declaringcontenttype
would have returned an exception.An example of the output with
![image](https://cloud.githubusercontent.com/assets/6642498/22065566/bd6e5240-dd80-11e6-840c-b642123755a8.png)
contenttype
declared:An example of the value/text pairs generated:
![image](https://cloud.githubusercontent.com/assets/6642498/22065754/8bc24d86-dd81-11e6-8b42-e3cf644268ca.png)
The
contenttypes.yml
example:(The two
contenttypes
being shown areevent
andeventseries
)Of course the output style could be changed if anyone would prefer a different format!
Target branch
release/3.2
— "stable" branch