Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
How to add the class class="text-truncate"
to the text in inbox ?
See the screenshots.
Comment | File | Size | Author |
---|---|---|---|
#7 | Capture d’écran du 2019 12 14 00 54 43.png | 214.93 KB | zenimagine |
#5 | Capture d’écran du 2019-12-13 11-14-43.png | 127.12 KB | zenimagine |
#4 | Screenshot 2019-12-13 at 1.06.01 PM.png | 114.98 KB | anmolgoyal74 |
#3 | Capture d’écran du 2019-12-12 19-55-44.png | 229.25 KB | zenimagine |
#3 | Capture d’écran du 2019-12-12 19-55-26.png | 207.39 KB | zenimagine |
Comments
Comment #2
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedYou have to override the template for the messages. If you enable to debug mode, you can see the template file name suggestion. Create the file in your custom theme.
Comment #3
zenimagine CreditAttribution: zenimagine commented@anmolgoyal74 I have several models. Which model should I use ? Thank you
Comment #4
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedYou can use the highlighted field template file.
Comment #5
zenimagine CreditAttribution: zenimagine commented@anmolgoyal74 It does not work. I test with this templates :
private-message--inbox.html.twig
But how do you display false fields ?
The following code does not work. I want to display the fields in the screenshot :
Comment #6
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedCreate the template file with name "field--private-message--message--private-message.html.twig" and place it under template folder in your theme.
and add the following code in it.
Comment #7
zenimagine CreditAttribution: zenimagine commented@anmolgoyal74
Thanks but it changes the conversation and the inbox. I'm looking to modify only the inbox. See the screen capture.
Comment #8
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedFor this requirement, You might have to create the template file for the block.
Comment #9
zenimagine CreditAttribution: zenimagine commentedIs it possible to add a parameter in "manage the display" to customize the class ?
Comment #10
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedI don't think it is possible. Even it is, Then it will be added to both block and the conversion.
What you can do is that you can target the block using block's classes and then implement custom CSS for the block if it solves the problem.
Comment #11
zenimagine CreditAttribution: zenimagine commentedIs it possible to do this in the
.theme
file ?To add the class to
Comment #12
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedWith "this", what are you referring to?
Comment #13
zenimagine CreditAttribution: zenimagine commentedI have the following file in my theme. is there a code to add in to add a class to the
tag in the inbox ?
bootstrap_subtheme_front_office_old.theme
Comment #14
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedI don't think you have to add any code in the .theme file for this. Just create the template file, you might have all the variables available in the template file already.
Comment #15
zenimagine CreditAttribution: zenimagine commentedThe model closest to the
tag is as follows :
https://git.drupalcode.org/project/private_message/blob/8.x-2.x/template...
The name suggest is
private-message--inbox.html.twig
But I don't know how to add the class. Is it possible to add TWIG code in the model to customize the fields ?
Currently we cannot customize anything for private message with this TWIG file.
Comment #16
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedzenimagine,
Is this issue resolved?
Comment #17
zenimagine CreditAttribution: zenimagine commentedI solved a problem by adding the style directly to my CSS file, but I would have preferred to use the class in TWIG
Comment #18
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commented