The code in block--lb-hero--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-hero.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-hero--variation-*.html.twighave set statements to assign variables, then use extends to reference the base template.

Acceptance Criteria

  • code diff should have lots of deletions
  • front-end should have no changes from prior behavior

Issue fork lb_hero-3403739

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 committed e80589f9 on 1.2.x
    Issue #3403739: De-duplicate code in twig templates
    

  • david-b committed b0ca5d21 on 1.2.x
    Issue #3403739: select default variation
    

  • david-b committed 2fe6433a on 1.2.x
    Issue [#3403739]: exclude content from twig template
    
froboy’s picture

Version: 1.2.1 » 1.2.4
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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