[2.x] Alternative layout, OR add ability for basic filtered text-HTML

Created on 17 February 2021, almost 4 years ago
Updated 12 December 2022, about 2 years ago

It would be absolutly great if we could introduce an alternative layout. We did this manually by
- adding two extra fields (Banner Title + Banner Intro) to JS and Drupal module
- Change the order of the fields in the JS

Output is a modal dialog (see screenshot attached)

Would it be possible to add the 2 extra fields to library and Drupal module + add a config setting to switch between layouts (change field order in rendered output)?

OR Alternativ improvement:

Add the ability to enter basic html to textarea fields in the text-config, to insert and style headings, sub-title and achieve basic markup dependend stylings. (<h2-h6 class>, <p class>, br, <span class>, strong, b, <a href class rel>)

✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany vistree

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡·Greece nkaramicha

    This feature is something that we would be interested as well, are there any updates on this?

  • πŸ‡ΊπŸ‡ΈUnited States chucksimply

    Also interested!

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    FYI: The larger plan for 2.x is to replace the React client by a Vue client: https://github.com/jfeltkamp/cookiesjsr-vue for many reasons (also license and technical). I think that should be done first, combined with other refactorings.

    Joachim started the implementation already, as you can see, but there's a lot of work to be done in this module and our small 3 person DROWL team is super busy for the next months. Joachim and we invested many development weeks into this module, so anyone who's interested in the future of the COOKiES module should consider helping or sponsoring to put this on more shoulders.

    Thank you!

  • πŸ‡ͺπŸ‡ΈSpain cbccharlie

    Hi,

    While the new VUE-based JS library is not available, we have implemented a small JS script that renders any HTML that is embedded in the banner. It is a completely provisional solution, but it can help those of us who have this need get through it. I'm only contributing it in case someone finds it useful, but it's still minimally tested.

    (function (Drupal, once) {
    
      'use strict';
    
      Drupal.behaviors.myCustomCookies = {
        attach(context, settings) {
          once('myCustomCookies', 'body', context).forEach(function (element) {
            const observer = new MutationObserver((mutations, obs) => {
              const cookiesBannerText = document.getElementsByClassName('cookiesjsr-banner--text');
              if (cookiesBannerText[0]) {
                const parser = new DOMParser();
                const textarea = document.createElement('textarea');
                textarea.innerHTML = cookiesBannerText[0].innerHTML;
                const cookiesBannerHTML = parser.parseFromString(textarea.value, 'text/html');
                cookiesBannerText[0].innerHTML = cookiesBannerHTML.firstChild.innerHTML;
                obs.disconnect();
              }
            });
            observer.observe(document.body, { attributes: true, childList: true, subtree: true });
          });
        },
      };
    
    }(Drupal, once));

    In addition to this, it would be necessary to define the library and load it with the component.

    Thanks!

  • Assigned to jfeltkamp
  • πŸ‡©πŸ‡ͺGermany jfeltkamp Hamburg

    Will be fixed in version 2.x.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @jfeltkamp is this already fixed? Could you give us an update on the status or plan? Should this be a blocker for stable 2.0.0?

  • πŸ‡©πŸ‡ͺGermany jfeltkamp Hamburg

    From the side of the JS-library it is fixed.
    But now I want to add HTML editors for the fields in the Drupal config forms, so that this would work out of the box.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Nice, thank you @jfeltkamp! :) Looking forward to that! Should you need assistance, feel free to ping us.

Production build 0.71.5 2024