Closed jcsparks closed 8 months ago
Shortcode issues should go in the Migration Shortcodes repo to avoid cluttering our other repos with such an antiquated technology.
As for why they're not working in this field, I'm not exactly sure. Contact info is standard in that it's WYSIWYG field using our text format, but special in that it isn't part of any block type, paragraph type, or content type. I don't see extra <p>
tags inserted or any other funny business that could interfere with the Shortcode I entered. @jnicholCU do you have any ideas on this one?
I'm guessing it may need a partial rewrite of the contact info block to work. Whatever the Shortcode module hooks into likely isn't getting triggered by the way this field is rendered on the page. Template file: block--site-info.html.twig
in the theme, line 46:
<span class="ucb-site-contact-info-footer-content ucb-site-contact-info-footer-general-content">{% if item.value.format == 'wysiwyg' or item.value.format == 'full_html' %}{{ item.value.value | raw }}{% else %}{{ item.value.value | nl2br }}{% endif %}</span>
Yeah it looks like the |raw
could be the issue. We shouldn't be using that anyways so that is something we should change for the rendering of that item value.
Barring that I'm not sure why it wouldn't work in that field as it's using the normal ckeditor 5 wysiwyg field.
Will try out some things with the way we're grabbing that value because the item.value.value
might be causing the difference here.
I would've only used |raw
as a last resort, definitely after trying everything else.
It's not like a field on a node or block type, it was only giving me the HTML from the WYSIWYG as a string.
Yeah I was going through it some more last night and it's mostly likely because it's just being passed in as a string of html.
I've got a couple ideas of how to get it working so I'm going to test those this morning. I also think I know how to switch from the |raw
at the very least. I'll keep you guys posted.
@timurtripp are we able to get "#formatter" => "text_default"
and "#type" => "processed_text"
added to our site config values for that item?
Need to pass through the processed item rather than the data string if possible. According to documentation (some guy on stackexchange) that should hopefully fix our issue.
From what I can tell formatter
needs to be at the same level as the label
and type
needs to be within the value
with format
I don't know if this is going to actually fix the issue or not. I'm not sure what the needs to be done for the site config to transfer processed text instead of a string in the array.
@jnicholCU Site Configuration/src/Plugin/Block/SiteInfoBlock.php
I'm not seeing that working though.
After playing around with the render array I finally found a fix. PR up shortly.
Shortcodes in the Contact Info block don't seem to render properly. Not sure if this is an issue with the theme or the Site Configuration module.
It looks like this was a pretty common practice to use this to add icons into this area though... if it's possible to add support for shortcodes in that block it would help make the migration go more smoothly.