Closed (fixed)
Project:
Double Field
Version:
4.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
25 Aug 2021 at 07:31 UTC
Updated:
23 Sep 2021 at 14:29 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
chi commentedYes, it's possible but
h3is not about CSS but HTML. You need to overridedouble-field-item.html.twigin our theme.1. Copy the template from the module to your theme.
2. Change the markup as you need. It could be something like this.
Unfortunately this will be applied to all double field instances on a site. If you need to style double fields differently then you need to add a custom theme suggestion based on field name.
Comment #3
liliplanet commentedAwesome, that is perfect, thank you!
Comment #4
liliplanet commentedHi Chi, gosh thank you so much for all your help 🌷
I'm a little confused, some time ago you kindly added line breaks in long text:
but as in the above thread, I want to add h3 to item.first, copied the template, but where do I now add the h3 and still have line breaks?
I have tried the following, but no line breaks
double-field-item.html.twig has changed, or just totally blonde here? 😂
Comment #5
chi commentedSorry, I omitted them in the previous snippet.
Comment #6
liliplanet commentedOh, that is just so beautiful, thank you Chi 🌿
One very last question ☺️
I'm using double field for biographies, need to add a link to their external url's.
* Is there any chance that full url's automatically turn into links please?
Comment #7
chi commentedNot sure if understand this. Anyway you can render links in the Double Field template same way.
Something like this.
Comment #8
liliplanet commentedThank are so very kind, you so much Chi, I should have been more clear ..
In item.second (long text), users add a biography and a link to IMDB.com, for example:
Currently the url does not turn into a link, is that possible please?
Comment #9
chi commentedDouble Field does not support this. However, if you have Twig Tweak module installed it's possible to apply text formats to the field value.
check_markupfilter to the double field value as follows.Instead of 'text_format_id' use a real ID of the text format, i.e. 'restricted_html'.
Comment #10
liliplanet commentedOmg Chi, you are such a star ✨ thank you so so much, works perfectly 😁
Comment #12
liliplanet commentedVery very excited, thank you @Chi 🌷
Hoping that the following will be available 😊
Just so appreciate your work on this exceptional module.
Comment #13
chi commentedDouble Field 4.0 has just been released.
It does support theme suggestions based on field name. For example, if the field is named "field_example" the appropriate item template would be "double-field-item--field-example.html.twig".
Here is a guide about locating template files.
https://www.drupal.org/docs/theming-drupal/twig-in-drupal/locating-templ...
Comment #14
chi commentedThere is no UI for that cases but it can be easily done in the item template. Basically, it contains two variables that can be used to construct whatever markup you want. Of course that requires some very basic knowledge of Twig and HTML.
As of social networks it could be done like that. Assuming that the first subfield holds the name of the social network, i.e. facebook. twitter, etc.