The code in block--lb-cards--variation-*.html.twig contains highly duplicated code. In order to maintain a DRY codebase and reduce our codebase “weight”, we should de-duplicate code wherever possible.

A possible model for this could be:

  • block--lb-cards.html.twig contains the base code for all variants with block statements and switching logic.
  • set statements should all be made before any div to maintain separation of concerns.
  • block--lb-cards--variation-*.html.twig have set statements to assign variables, then use extends to reference the base template.

Acceptance Criteria

  1. code diff should have lots of deletions
  2. front-end should have no changes from prior behavior

Issue fork lb_cards-3403660

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

david-b created an issue. See original summary.

david-b’s picture

Issue summary: View changes

  • david-b committed be463a39 on 2.0.x
    Issue #3403660: De-duplicate code in twig templates
    

  • david-b committed c8af6e8b on 2.0.x
    Issue #3403660: select default variation
    

  • david-b committed b4e9bd28 on 2.0.x
    Issue [#3403660]: exclude content from twig template
    

  • david-b committed 11c0d604 on 2.0.x
    Issue [#3403660]: fix CTA placeholder is displayed in cards when CTA...
froboy’s picture

Version: 2.0.x-dev » 2.0.8
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.