Score:3

How to not split select list by content type

sa flag

This is about the regular select widget that you can choose in the Manage form display page.

If this widget is linked to an entity_reference field allowing several bundles to be selected; then you end up with an #options populated as follow:

_none -> "None"
Bundle label 1 ->
  id1 -> "label of ID 1"
  id3 -> "label of ID 3"
  id4 -> "label of ID 4"
Bundle label 1 ->
  id5 -> "label of ID 5"
  id6 -> "label of ID 6"

I would like to have

_none -> "None"
id1 -> "label of ID 1"
id3 -> "label of ID 3"
id4 -> "label of ID 4"
id5 -> "label of ID 5"
id6 -> "label of ID 6"

Is there any option to change? or should I hook something?

Score:4
cn flag

It would be nice if this were optional, but ...

You will have to write a hook_form_alter or similar to rewrite/reorganize the options in the field: They're organized in logically obvious subarrays matching what you see on screen. You can "flatten" them into a single array and re-order the options as you please.

Baud avatar
sa flag
Thanks you, I accepted your answer because you explain that there are no simple way except flattening manually. Note that using a view to populate the options doesn't solve the problem... [maybe you can update your answer for this point]
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.