Widget Template Not Applying Some Args

Hello!

I think I’m missing something with widget XML configuration. I have the following template:

<widget type="template">
  <title>Formatted Event Listing</title>
  <args>
    <arg id="widget_template">featured</arg>
    <arg id="clean_markup">true</arg>
    <arg id="max">5</arg>
    <arg id="paginate">false</arg>
    <arg id="group">Main Calendar</arg>
    <arg id="hide_repeats">true</arg>
    <arg id="has_location">true</arg>
    <arg id="thumb_width">600</arg>
    <arg id="thumb_height">600</arg>
    <arg id="hide_date_headers">true</arg>
    <arg id="class">formatted-events</arg>
    <arg id="format_widget">
      <div class="d-flex featured_events_widget row">
      {widget}
      </div>
    </arg>
    <arg id="format">
      <div class="lw_cal_event_info formatted-events">
        <div class="lw_events_location">
          <field var="location" substring="0,50" />
        </div>
        <div class="lw_events_time"> {date} - <span class="lw_start_time">{start_time}</span> - <span
            class="lw_end_time">{end_time}</span> <span class="postfix">{until}</span>
        </div>
        <div class="summary-container">
            {image} <div class="lw_events_title"> {title} </div> <div
            class="lw_events_summary">
            <p> {summary} </p>
          </div>
        </div>
      </div>
    </arg>
  </args>
</widget>

When I apply this template to a widget there are a couple args that aren’t being set correctly.

Specifically:

  • thumb_width
  • thumb_height

The widget does show that those fields are coming from the template but the elements aren’t changed

I’m sure I’m missing something simple.

Also, kind of related, the argument “hide_date_header” is in the widget syntax preview as “hide_date_headers”, what’s the correct name?

Thanks!

First thought is whether the CSS of the site is affecting the rendered image size. For example, .summary-container img {max-width: 100px;} or similar.

Second thought is the exact rendering of images. Most I think now use <picture><source/><img/></picture>, but some of our older widgets still use simple <img>. Perhaps there’s some detail in the CSS rules where one approach is styled correctly, but this uses the other (somehow) which isn’t. (Seems unlikely in this case, but I don’t know your CSS.)

For the one argument, I think it is hide_date_header, going by documentation.

Thanks Nick!

And hey Greg – one other possibility, is that an event coming from a linked calendar?

If it’s a linked calendar event with an external image (coming from the iCal ATTACH: entry) then widget settings aren’t able to change the size of that image, we just hot-link to whatever URL is referenced in the ATTACH: line.

And whoops, good catch about hide_date_headers – that was my typo in the docs, leaving out the “s,” I’ve got that fixed now: Setting: hide_date_headers - LiveWhale Support

Thanks Nicholas!

The styling doesn’t seem to be the issue, when I reset the arg the image displays as expected.

The image is rendering with a source set:

Other templates seem to work as expected, for what that’s worth.

I wonder if it’s an XML parsing issue… but it does update when edited. I don’t know.

Thanks for the clarification on the date header, I’ll put in a bug ticket

Whoops, I didn’t see Karl’s response when I posted.

I don’t think it’s from a linked calendar, I’m pretty sure everything is coming from our LW events. And it does resize when I manually change it in the widget form.

Thanks Greg – feel free to paste or attach the current widget template here, if you can provide step-by-step instructions to reproduce, we can try it on our servers to help confirm if it may be a core LWC bug. Thanks!

Sure, it’s above in the first comment. I’ve been messing around with it to see if there’s a fix to stumble on but that’s still accurate

Thanks, hm. When I save that to my own LWC server, I do see images being returned in the preview at 600x600.

(I also notice, you could remove <arg id="widget_template">featured</arg> from the widget template .xml file – that’s the line you use to call out to a widget template, and I don’t believe we support nested templates, so probably it’s best to avoid confusion by making it look like your WT might be calling out to another WT.)

OK removed that and tried again, still getting the wrong image size. The widget code generated is:

<widget type="events">
<arg id="widget_template">formatted-event-list-template</arg>
<arg id="max"></arg>
<arg id="paginate"></arg>
<arg id="clean_markup"></arg>
<arg id="group"></arg>
<arg id="hide_repeats"></arg>
<arg id="has_location"></arg>
<arg id="class"></arg>
<arg id="max">5</arg>
<arg id="paginate">false</arg>
<arg id="group">Main Calendar</arg>
<arg id="hide_repeats">true</arg>
<arg id="has_location">true</arg>
<arg id="clean_markup">true</arg>
<arg id="hide_date_headers">true</arg>
<arg id="format"><div class="lw_cal_event_info formatted-events"> <div class="lw_events_location"> <field var="location" substring="0,50"/> </div> <div class="lw_events_time"> {date} - <span class="lw_start_time">{start_time}</span> - <span class="lw_end_time">{end_time}</span> <span class="postfix">{until}</span> </div> <div class="summary-container"> {image} <div class="lw_events_title"> {title} </div> <div class="lw_events_summary"> <p> {summary} </p> </div> </div> </div></arg>
<arg id="class">formatted-events</arg>
</widget>

Is it possible I might have changed something upstream accidentally? Any templates I should look at? I don’t think I touched core but maybe I did accidentally

I went back and started from zero and of course, it was a CSS issue. I was applying a class that I didn’t need to with the new design!

Thanks for all the help!

1 Like