Before on this specific question, the basic problem:
I want to allow a user to choose between image presets/styles for an image in an image field at the top of a node.
Image field only allows coars settings here for all image fields and not on a per entity basis. I have 3 possible workaround I can think of:
1. Have multiple image fields and depending on the size, the person has to choose the right one. This seems hacky for the user.
2. Add extra data to the image field - in this case a new preset/style comment to the image field table and copy a formatter with the relevant changes. However core does not allow the manipulation of the field schema (and from what I can see doesnt provide the ability to store extra data of any sort other than what is defined), so that will need to be hacked around but for the end user it seems the simplest.
3. Add another field which allows the user to change the view mode(s) depending on the prefered displayed image size.
Does anyone have any ideas on how to proceed on this? Number 3 seems the simplest conceptually, but I will need to figure out how its done and I cant seem to find any relevant samples using google.
Comments
Display suite has a feature
Display suite has a feature where you can allow the display mode to be selected for each node, maybe this would work for you.
Display suite is for admins
Display suite is for admins only from what I can tell.
I cant see a way for a user to be able to choose the view mode per node (so a check box or radios when editing allowing them to choose the view mode).
(@mods - I think this is about more than just a post install question and will require custom code, that is why I had put it in the module development topic. The main issue of allowing a user to choose the image style for the node is one that could fit into a module and be reusable for others.)
No you can do it with DS: -
No you can do it with DS:
- enable view mode per node in the extra's
- try node/x?v=full.
Found my own solution
I went another way instead and i dont think the above is too convenient.
There are now a few modules offering the same functionality too.
My way is listed here: http://drupal.org/node/1363250#comment-5540998 and the next post links to modules which came afterwards and I have not tried but are trying to create the same feature.
Bump - Contextual View Modes
Any luck finding the answer? I can't find a workable solution.
The closest was "Contextual View Modes" (https://drupal.org/project/contextual_view_modes), but this simply allows authors to select a view mode when uploading content. I need something that will switch view modes based on selections from radio buttons in the form.
Example: The author selecting "red" will display the node using a 2 column layout. Selecting "Green" displays as 3 columns. Etc.
Ideas anyone?
Thanks
subscribe
subscribe
Separate view mode for each
Create a new view mode for the second display and show it for your case.
You can do this using hook_entity_view_mode_alter in a custom module.
Based on the field value, set the $view_mode = 'new_display_mode'