The cart block has the icon and the title text in a h2. There appears to be no way to make the icon appear without the title.

I just need the icon with the link when empty. When full, the linked icon by itself or with a count, nothing else.

Comments

peterx created an issue. See original summary.

peterx’s picture

The h2 is not created in uc-cart-block.html.twig or uc-cart-block-title.html.twig. Editing them is useless.

TR’s picture

Status: Active » Fixed

Edit uc-cart-block-title.html.twig
That does work.

peterx’s picture

@TR, uc-cart-block-title.html.twig produces the contents for the h2 but not the h2. I can change the contents but not remove the h2.

uc-cart-block.html.twig produces the contents after the h2 in the block but not the h2. There must be code or a twig template one level up to bring the two components together. Part of the change has to be at that higher level.

For now, I edited those two twig files to remove all the text inside the h2 and the rest of the block.

UC Cart needs a way to show the icon and remove the heading. The configuration for the block lets you switch the heading off and the icon on but the icon does not appear when the heading is off because the icon info is used only in the title. If show_icon and show title were provided in uc-cart-block.html.twig, the icon could be displayed when the title is off.

TR’s picture

All blocks in Drupal have a title and a body. The markup around these is controlled by the core Drupal block module, and the block.html.twig template used by that module. If you want to change the h2 markup around the title, you need to change that template (which will affect all blocks) or make a new block template just for the cart block. Again, this is all core Drupal theming, nothing to do specifically with Ubercart.

peterx’s picture

I commented out some lines in uc-cart-block-title.html.twig to remove the heading and changed uc-cart-block.html.twig to display the icon. The result is what is needed for this case. It makes the icon display permanently on instead of switchable.

peterx’s picture

Status: Fixed » Closed (fixed)