-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #870 from StadGent/release/8.x-4.0
Release/8.x-4.0
- Loading branch information
Showing
24 changed files
with
233 additions
and
6,274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Add native lazy loading support to images. | ||
*/ | ||
|
||
use Drupal\image\Plugin\Field\FieldType\ImageItem; | ||
|
||
/** | ||
* Implements hook_preprocess_HOOK(). | ||
* | ||
* @see \template_preprocess_responsive_image_formatter() | ||
*/ | ||
function gent_base_preprocess_responsive_image_formatter(&$variables) { | ||
if (isset($variables['item'])) { | ||
_gent_base_add_img_attributes($variables['responsive_image']['#attributes'], $variables['item']); | ||
} | ||
} | ||
|
||
/** | ||
* Implements hook_preprocess_HOOK(). | ||
* | ||
* @see \template_preprocess_image_formatter() | ||
*/ | ||
function gent_base_preprocess_image_formatter(&$variables) { | ||
if (isset($variables['item'])) { | ||
_gent_base_add_img_attributes($variables['image']['#attributes'], $variables['item']); | ||
} | ||
} | ||
|
||
/** | ||
* Adds the HTML attributes required to get correct lazy-loading. | ||
*/ | ||
function _gent_base_add_img_attributes(array &$attributes, ImageItem $item) { | ||
if (!isset($attributes['loading'])) { | ||
$attributes['loading'] = 'lazy'; | ||
} | ||
// Tell the browser about the aspect ratio. | ||
if ( | ||
!isset($attributes['width']) | ||
&& !isset($attributes['height']) | ||
&& ($value = $item->getValue()) | ||
&& isset($value['width'], $value['height']) | ||
) { | ||
$attributes['width'] = $value['width']; | ||
$attributes['height'] = $value['height']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.mijn-gent-block, /// @deprecated | ||
.authentication { | ||
.login-link i { | ||
display: none; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.