Skip to content
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 v2 #6299

Conversation

mrenigma
Copy link

Continuing on from #6270 and the discussion had with @SahAssar I've modified the original implementation of this slightly so instead of determining the return value based on the existence of contenttype it instead does it based on whether multiple contenttypes have been defined. This separates the left hand side of the values string from the right more distinctly and allows more refined choice for the developer.

featured_items:
    label: "Event/Event series"
    autocomplete: true
    type: select
    values: (event,eventseries)/title

Would create a select option with <option value="event/1">Title</option>.

While

featured_items:
    label: "Event/Event series"
    autocomplete: true
    type: select
    values: event/contenttype,title

Would create a select option with <option value="1">Event / Title</option>

I know that it's already been merged in as is - happy for this to be closed without being pulled if everyone is more happy with the first implementation. I'm also always looking for feedback 😄

@SvanteRichter
Copy link
Contributor

Sorry to be a thorn in your side, but wouldn't this break existing select fields that look like this:

featured_items:
    label: "Event/Event series"
    autocomplete: true
    type: select
    values: event/title

And expect id only values?

@SvanteRichter
Copy link
Contributor

You could use the key option, which currently defaults to id, and add an option to set it to contenttype/id. See more on the key option here: https://docs.bolt.cm/3.2/fields/select#populating-the-values-from-a-contenttype

@mrenigma
Copy link
Author

@SahAssar no it wouldn't because the values string is not requesting multiple content types.

event/title will always return an ID based value with this implementation.

I did look at the key option but I would have needed to rip more things out to make that work 😬 . I didn't want to touch more than I needed to!

@SvanteRichter
Copy link
Contributor

@mrenigma ah, great! 👍

…d checks for multiple content types to determine if the select value returned is in the format of `id` or `contenttype/id`
@GwendolenLynch GwendolenLynch force-pushed the feature__select-multiple-contenttypes branch from 5077a3a to edee927 Compare January 25, 2017 12:19
@GwendolenLynch GwendolenLynch merged commit ad641cd into bolt:release/3.4 Jan 25, 2017
graham73may added a commit to graham73may/docs that referenced this pull request Jan 25, 2017
GwendolenLynch pushed a commit to graham73may/docs that referenced this pull request Jan 28, 2017
@mrenigma mrenigma deleted the feature__select-multiple-contenttypes branch February 6, 2017 12:51
@GwendolenLynch GwendolenLynch added this to the Bolt 3.4 - Feature release milestone Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants