Problem/Motivation

Hi again!

So at first I have installed LBCA without composer, regretted it, and rebuilt the whole site someplace composer was available. See, I wanted this module to work, badly.
But then I try it after installing through composer and... to no avail. It does exactly what it did before: "Refresh" button simply doesn't work.
Now, I made sure my theme does indeed load content attributes. Here's how it looks in block.html.twig:
<div{{ content_attributes.addClass('content') }}>

Exactly as it should, right?
But unfortunately, this great module still doesn't work.

Maybe it's just not supposed to work on Barrio?..
Any workarounds I can use to make it work?

Thanks!

CommentFileSizeAuthor
#7 3180469-bario-screenshot.png186.8 KBchris burge

Comments

toomanynights created an issue. See original summary.

chris burge’s picture

Can you post the contents of your block.html.twig file?

toomanynights’s picture

Hi Chris. Sure!

{#
/**
 * @file
 * Default theme implementation to display a block.
 *
 * Available variables:
 * - plugin_id: The ID of the block implementation.
 * - label: The configured label of the block if visible.
 * - configuration: A list of the block's configuration values.
 *   - label: The configured label for the block.
 *   - label_display: The display settings for the label.
 *   - provider: The module or other provider that provided this block plugin.
 *   - Block plugin specific settings will also be stored here.
 * - content: The content of this block.
 * - attributes: array of HTML attributes populated by modules, intended to
 *   be added to the main container tag of this template.
 *   - id: A valid HTML ID and guaranteed unique.
 * - title_attributes: Same as attributes, except applied to the main title
 *   tag that appears in the template.
 * - content_attributes: Same as attributes, except applied to the main content
 *   tag that appears in the template.
 * - title_prefix: Additional output populated by modules, intended to be
 *   displayed in front of the main title tag that appears in the template.
 * - title_suffix: Additional output populated by modules, intended to be
 *   displayed after the main title tag that appears in the template.
 *
 * @see template_preprocess_block()
 *
 * @ingroup themeable
 */
#}
{%
  set classes = [
    'block',
    'block-' ~ configuration.provider|clean_class,
    'block-' ~ plugin_id|clean_class,
  ]
%}
<div{{ attributes.addClass(classes) }}>
  {{ title_prefix }}
  {% if label %}
    <h2{{ title_attributes }}>{{ label }}</h2>
  {% endif %}
  {{ title_suffix }}
  {% block content %}
    <div{{ content_attributes.addClass('content') }}>
      {{ content }}
    </div>
  {% endblock %}
</div>
chris burge’s picture

Everything looks good there. I haven't worked with the theme in question. As additional troubleshooting steps, I would

  1. Try adding a Block attribute and a Block title attribute to see if they render in Bootstrap Barrio.
  2. Try switching the theme to Bartik to verify the Block content attributes render.
toomanynights’s picture

1. Doesn't work, because the attributes are not written anywhere: "Refresh button" does a few moments of loading and that's it. If I close the attribute configuring sidebar then, and open it again without leaving Layout Builder page, the attributes are gone.
2. Looks exactly the same on Bartik.

toomanynights’s picture

Chris, I got some new intel here.
Today I tried to use LBCA on user profile page layout. And, for some unexplainable reason, it worked like a charm.
So it does work on user pages, but it doesn't work on regular articles, although this theme's got a copycat of a block.html.twig file from Bartik. Weird!

chris burge’s picture

StatusFileSize
new186.8 KB

I installed Bootstrap Bario 5.x-dev and in my manual testing, the module works correctly with the theme. Content attributes do render.

I'm wondering if you're not running into a UX issue. The theme renders the alerts in an element that is fixed at the bottom of the screen. It covers the bottom of the settings tray that Layout Builder Component Attributes uses. This causes the 'Update' button to be covered:

Screenshot of Bootstrap Bario theme

toomanynights’s picture

Hi Chris. In my instance alert is on top of the page, and I can clearly see the "Update" button and press it.
Although I gotta tell you that now, a few Drupal updates later, it magically works as intended. I have no idea what exactly fixed it, but it's fixed. ¯\_(ツ)_/¯
As I seem to be the only one who had this problem, I guess the issue can be closed now. Thank you for trying to solve this.

chris burge’s picture

Status: Active » Closed (cannot reproduce)
mk1030’s picture

Hi!

I am running into the same problem described. I am using Bootstrap Barrio and installed the module but don't see any of the fields for adding classes, etc show up in the layout builder panel?

mk1030’s picture

Ok well, after clicking around, clearing the cache multiple times, etc (I did go to content-types-basic pages-Manage Display - Manage Layout), I finally saw the manage attributes link (I previously didn't see this. I am not sure what made it eventually show up, but wanted to let you know that I had the same experience as toomanynights.

I am glad it works for me now! Thanks for this module!

chris burge’s picture

@mk1030 - You were probably running into core issue #2773591: New contextual links are not available after a module is installed, which is also documented here for this module: #3193067: Manage attributes link not displaying for existing blocks.