If one creates a custom type, how does one get the node display to show the large image on top?
Which template has to be copied or modified to achieve this effect on the node display of the new content type?
I tried adding the existing field_topic_image field used by topic content type to the new content type, but when displaying the node, the large image on top does not show.
I apologize for my lack of experience with Drupal 8 theming and twig. I've been reviewing the layouts and templates, but any advice would be helpful.
In summary, how do we make the large hero image to be displayed on top for custom content types we add to our distribution?
Thanks.
Comment | File | Size | Author |
---|---|---|---|
#9 | Screen Shot 2017-07-21 at 12.44.37 AM.png | 97.09 KB | Carlos Miranda Levy |
#9 | Screen Shot 2017-07-21 at 12.44.12 AM.png | 104.77 KB | Carlos Miranda Levy |
#9 | Screen Shot 2017-07-21 at 12.43.44 AM.png | 46.4 KB | Carlos Miranda Levy |
Comments
Comment #2
Carlos Miranda Levy CreditAttribution: Carlos Miranda Levy as a volunteer commentedComment #3
Carlos Miranda Levy CreditAttribution: Carlos Miranda Levy as a volunteer commentedComment #4
DeBeukeleerM CreditAttribution: DeBeukeleerM as a volunteer commentedSomething similar is how to place the image on his proper place in the teaser display of a new content type. The image I added is allways placed inline instead of on the top (default) or on the left (teaser)
Comment #5
Carlos Miranda Levy CreditAttribution: Carlos Miranda Levy as a volunteer commentedFor anyone who hasn't figured this out yet and is looking for an answer to the same question:
field_your_content_type_machine_name_image
.field_sadsongs_image
.That's it. The template will do the rest and automatically pick up the image from the
field_your_content_type_machine_name_image
field and will use it and display it as the large header image for the page.:-)
Comment #6
Carlos Miranda Levy CreditAttribution: Carlos Miranda Levy as a volunteer commentedComment #8
Pegasus360 CreditAttribution: Pegasus360 commentedThanks Carlos Miranda Levy for your response.
I realize this has been closed as fixed but I cannot recreate your success in this process.
I previously posted this issue
https://www.drupal.org/node/2883427
But it has not received any response.
I have tried and tried to get the theme to pick up the image. (of course clearing caches along the way)
I have tried it on a site where the header image shows up on the default content type (like event) but a new content type with the above image setup results in a grey or black hero image instead of the article image.
I have also tried to make the default content type show the black background but the image still appears.
I would love to use this theme on my sites but this problem is beyond frustrating.
Thoughts??
Comment #9
Carlos Miranda Levy CreditAttribution: Carlos Miranda Levy as a volunteer commentedWhat's the machine name of your custom content type?
That's the name you have to use to name the field for the image that's picked up by Open Social to be displayed as header.
In my case, I created a content type called civ_media_gallery.
So for the image field to be used for header image, it has to be named field_civ_media_gallery_image.
And remember to disable it or hide it for both Default and Teaser display.
I hope the screen captures below help you better understand:
Field definition:
Form Display:
Display:
Comment #10
Pegasus360 CreditAttribution: Pegasus360 commentedThanks Carlos Miranda Levy.
That was it!! Matching names.
Your clarification made my day, week, and month wonderful.
In hindsight it was very simple... all I had to do was follow your instructions... oh and read the details first.
Thanks so much for taking the time to help out. This is what makes open source/Drupal community great.
Comment #11
Carlos Miranda Levy CreditAttribution: Carlos Miranda Levy as a volunteer commentedGlad it worked :-)
It took me a while to figure it out too and I knew it should be easy!
(I was diving into templates and code trying to achieve it) - in the end it was a lot easier than imagined :p
Comment #12
Pegasus360 CreditAttribution: Pegasus360 commentedIt seems to be even easier.
From what I have tried the only thing that matters is the machine field names that match.
The widget configuration on the manage form doesn't seem to matter nor does hiding the image field in the manage display.
Just as long as the machine names match EXACTLY with "_image" at the end and the appropriate social core title block is activated for that content type then the title image block should display.
I had a content type that had a long machine name. When I added the image field with the required name protocol I realized the last part of the machine name was missing. In other words with '_image' at the end only the '_im' was present. DID NOT WORK.
Had to build another custom content type with a shorter machine name.
I always wonder... where is the documentation when they create these fabulous ideas....??
Thanks again.
Comment #13
itsnadeem CreditAttribution: itsnadeem commenteddrupal 8 adding header tags based on content type