Make full Cards/boxes clickable, not only title
Summary
In the current implementation of cards/boxes, only the title is clickable. Change it so that the whole card will be clickable.
Implementation
The ticket concerns two type of components/patterns: preview-card
and related-card
. The following implementation concerns preview-card, apply the same changes in the other one, too.
- The
html
structure of the card is defined in https://gitlab.cern.ch/web-team/drupal/public/d8/modules/cern-components/blob/master/patterns/molecules/preview-card/preview-card.html.twig. - The implementation is a bit tricky. The link is created in https://gitlab.cern.ch/web-team/drupal/public/d8/modules/cern-components/blob/master/patterns/molecules/preview-card/preview-card.html.twig#L114 using a twig filter
openLink
, which is defined in this PHP file => https://gitlab.cern.ch/web-team/drupal/public/d8/modules/cern-components/blob/master/src/TwigExtension/CernComponentsTwigExtension.php -
openLink
actually wraps the title with a link - Change the implementation so that the link will wrap the whole card instead of just the title.
- For your implementation create a branch from
dev
branch.
Edited by Konstantinos Platis