- Issue created by @axle_foley00
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
Hi axle_foley00, I thought a lot about how to achive titles with ability to add formatting, links, small images, etc. And keep it semantically good. I thought to use Fences module and make it sematically better:
https://www.drupal.org/project/fences →But then fields configs became too big and complicated, installation EBT/EPT modules will affect on other content types, paragraph types and block types, because Fences will be everywhere. I refused an idea to use Fences, but it's still possible to use it for any EBT/EPT modules.
I also thought to remove hardcoded
tags from templates, and add
tags in CKEditor as Header style. I used this approach on few commercial projects and it's working fine. But it's not obvious for regular editors, why Title field is not becoming
automatically.
Also I thougt to use Fences modules to set field wrapper H2 tag, but sometimes it's needed to use H3 or H4 tags instead for block titles.
I can add additional settings field Title Tag checkbox or select list with H2, H3, H4, None, options and display title tag based on this option.
If you have any ideas, feel free to share them. I will be glad to hear any feedback.
- 🇯🇲Jamaica axle_foley00
Hey @levmyshkin,
Okay I understand your motivation now for having things the way they currently are. The use case of being able to quickly add an image/icon with the Title is a useful one. I had a project that required something like that but I just decided to add those icons beside the titles as a background image using CSS.
I do agree that ideally we wouldn't want to make the configs too big and complicated.
I'm wondering if adding an option similar to the Style settings in Views could work. So as you said, have the select list with the options H2, H3, H4, None, etc.. and then display based on that.
- Assigned to rohitsharma401
- 🇮🇳India rohitsharma401
we can use
|replace({'': '', '
': ''})
directly in the twig file where we are rendering.The replace filter is used to remove specific HTML tags.{'
': '', '
': ''} specifies that any
tags and their corresponding closing
tags should be replaced with an empty string, effectively removing them.
I will add a patch file for this.
- Issue was unassigned.
- Status changed to Needs review
5 months ago 6:59am 11 July 2024 - 🇮🇳India rohitsharma401
i have done this directly in the Twig template where in the title field at the time of rendering .
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
Hi rohitsharma401, thank you for your patch, but we need to solve another problem, we should avoid
tags inside
tags.
Here is a discussion about removing extra divs:
https://www.drupal.org/forum/support/theme-development/2022-07-27/fixed-... →And even here is potential problems with Quick editing, possibly for Mercury Editor too:
https://www.drupal.org/project/mercury_editor →
https://www.drupal.org/project/quickedit →Looks promising by the way, quick editing is needed only for editors and Google will not see page with additional
wrappers for quick editing. -
levmyshkin →
committed 153b9869 on 1.4.x
Issue #3460287 by axle_foley00: EPT Title Field WYSIWYG causing...
-
levmyshkin →
committed 153b9869 on 1.4.x
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
Hi axle_foley00, I added new Title Options for EPT settings:
It's going to strip tags by default and show only h2 tag (optionally too). You will need to update EPT Core, EPT Columns and re-save EPT paragraphs on your site.
It's still possible to use
<br>
,<img>
,<i>
,<span>
for settings styles and multiple lines for title.I will update all other EPT modules eventually too.
- Status changed to Fixed
5 months ago 11:57am 17 July 2024 - Status changed to Fixed
5 months ago 11:57am 17 July 2024 - 🇷🇸Serbia levmyshkin Novi Sad, Serbia
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
By the way, it will brake Quick Editing, but I'm good for now with this solution, since Mercury is not working with CKEditor 5, it's not usable for now.
- 🇯🇲Jamaica axle_foley00
@levmyshkin and @rohitsharma401, okay great thanks! I'll update the modules in my install to get the new changes.