Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #2
peterx CreditAttribution: peterx as a volunteer commentedThe h2 is not created in uc-cart-block.html.twig or uc-cart-block-title.html.twig. Editing them is useless.
Comment #3
TR CreditAttribution: TR commentedEdit uc-cart-block-title.html.twig
That does work.
Comment #4
peterx CreditAttribution: peterx as a volunteer commented@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.
Comment #5
TR CreditAttribution: TR commentedAll 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.
Comment #6
peterx CreditAttribution: peterx as a volunteer commentedI 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.
Comment #7
peterx CreditAttribution: peterx as a volunteer commented