I need to style some part of the accordion tabs titles (for exemple applying a colour on a word in the middle of the title). Currently, the title strips all html elements. Is it possible to allow some HTML selectors in title, like "span", "strong", "u", etc.?
It should be noted that the Javascript adds HTML to the title, so if Drupal behaviors are attached more than once, the added HTML and the title will be stripped.
Issue fork ckeditor_accordion-3027754
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ToxaViking commentedHello Xoruna
You should configure allowed tags at the text format configuration page
Comment #3
ToxaViking commentedComment #4
xorunaI'm using full html text format, which doesn't limit allowed text format. Is there something else to configure?
Comment #5
xorunaComment #8
atropoidesI found out that it used the jQuery text method that strips out all html from the title.
To use html in the title I changed it to the jQuery html method.
See Merge Request #3.
Comment #9
nitebreedExactly what I needed in one of my projects as well, works perfectly!
Comment #10
xorunaThanks for your contribution Atropoides! The project I needed this for is over, but I'm sure it will be useful in the future.
Comment #12
bernardm28 commentedI probably should have done that change on a separate PR. However, the commit above does not add anything new. It just brings back some of the accessibility items that the module itself provided and it merges those with Atropoides changes.
Comment #15
hydra commentedI added a second MR where I upgrade the solution to work with the non-jquery version in 2.0.x branch for everyone using this and doing an upgrade.
Comment #16
charles belovIt would also need to be possible to add language spans if one of the accordion titles is in a different language.
Comment #17
solideogloria commentedThis change is actually necessary for the accordion to work at all in the 2.0.x version if the behaviors are attached more than once. I think maybe the
oncefunction isn't working properly? If behaviors are attached a second time, all the accordion title text disappears.Notice that
onceis not added as a parameter where it should be:Comment #18
solideogloria commentedMarking as a bug report because of this.
Comment #19
solideogloria commentedComment #20
solideogloria commentedComment #21
solideogloria commentedApplying the changes in MR 12 fixes the issue.
Comment #22
j-vee commentedThanks everyone, there's a new configuration option in 2.2.2 to Allow HTML in Titles.
Comment #23
j-vee commented