Skip to content

Commit

Permalink
BW-133: Add Drupal 9 support (#871)
Browse files Browse the repository at this point in the history
* BW-133: Add drupal 9 support

* BW-133: Update composer.lock

* DTGB-850: Fix wrong font as logged in user

* Replace deprecated class timeline.

* DTGB-851: Update styleguide to 4.1.0

* Fix coding standards.

Co-authored-by: Jeroen Degloire <[email protected]>
  • Loading branch information
jeroendegloire and Jeroen Degloire authored Dec 29, 2020
1 parent 28bd7e5 commit 35a0c7b
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 48 deletions.
22 changes: 19 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,27 @@

All Notable changes to `digipolisgent/drupal_theme_gent-base`.

## [4.1.0]

### Add

* BW-133: Add support Drupal 9.

### Update

* DTGB-851: Update styleguide to 4.1.0.

### Fix

* DTGB-850: Fix wrong font as logged in user.

## [4.0]

### Added

* DTGB-841: Added native lazy load to images.

## Updated
### Updated

* DTGB-849: Updated styleguide to 4.0.2

Expand All @@ -18,11 +32,11 @@ All Notable changes to `digipolisgent/drupal_theme_gent-base`.
* KAG-437: Fixed overridden spacing on file element.
* DTGB-848: Fixed security vulnerabilities.

## Replaced
### Replaced

* DTGB-849: Replaced removed/deprecated CSS classes.

## Removed
### Removed

* DTGB-847: Removed overridden styling file-upload styleguide.

Expand Down Expand Up @@ -541,6 +555,8 @@ All Notable changes to `digipolisgent/drupal_theme_gent-base`.

* **Updated to gent_styleguide version 2.6.13**

[8.x-4.1.0]: https://github.com/StadGent/drupal_theme_gent-base/compare/8.x-4.0...8.x-4.1.0
[8.x-4.0]: https://github.com/StadGent/drupal_theme_gent-base/compare/8.x-3.3...8.x-4.0
[8.x-3.0-beta17]: https://github.com/StadGent/drupal_theme_gent-base/compare/8.x-3.0-beta16...8.x-3.0-beta17
[8.x-3.0-beta16]: https://github.com/StadGent/drupal_theme_gent-base/compare/8.x-3.0-beta15...8.x-3.0-beta16
[8.x-3.0-beta15]: https://github.com/StadGent/drupal_theme_gent-base/compare/8.x-3.0-beta14...8.x-3.0-beta15
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"require": {
"php": ">=7.2",
"drupal/coder": "^8.2",
"drupal/core": "^8.8.2"
"drupal/core": "^8.8.2 || ^9.0"
}
}
24 changes: 21 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gent_base.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Gent Base
description: Ghent base theme. Always use a subtheme of this theme.
type: theme
core: 8.x
core_version_requirement: ^8 || ^9
base theme: classy
hidden: true
regions:
Expand Down
39 changes: 22 additions & 17 deletions gent_base.theme
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,9 @@ function gent_base_theme_suggestions_facets_result_item_alter(array &$suggestion
* This is a guideline determined by Stad Gent!
*/
function gent_base_preprocess_pager(&$variables) {
/* @var $pager_manager \Drupal\Core\Pager\PagerManagerInterface */
$pager_manager = \Drupal::service('pager.manager');

$element = $variables['pager']['#element'];
$parameters = $variables['pager']['#parameters'];

Expand Down Expand Up @@ -1052,48 +1055,50 @@ function gent_base_preprocess_pager(&$variables) {
$i = $pager_first;
if ($pager_last > $pager_max) {
// Adjust "center" if at end of query.
$i = $i + ($pager_max - $pager_last);
$i += ($pager_max - $pager_last);
$pager_last = $pager_max;
}
if ($i <= 0) {
// Adjust "center" if at start of query.
$pager_last = $pager_last + (1 - $i);
$pager_last += (1 - $i);
$i = 1;
}

$items = [];

// Create the "first" and "previous" links if we are not on the first page.
if ($pager_page_array[$element] > 0) {
$items['first'] = [];
$options = [
'query' => pager_query_add_page($parameters, $element, 0),
'query' => $pager_manager->getUpdatedParameters($parameters, $element, 0),
];
$items['first']['href'] = \Drupal::url($route_name, $route_parameters, $options);
$items['first']['href'] = Url::fromRoute($route_name, $route_parameters, $options);
if (isset($tags[0])) {
$items['first']['text'] = $tags[0];
}

$items['previous'] = [];
$options = [
'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] - 1),
'query' => $pager_manager->getUpdatedParameters($parameters, $element, $pager_page_array[$element] - 1),
];
$items['previous']['href'] = \Drupal::url($route_name, $route_parameters, $options);
$items['previous']['href'] = Url::fromRoute($route_name, $route_parameters, $options);
if (isset($tags[1])) {
$items['previous']['text'] = $tags[1];
}
}

if ($i != $pager_max) {
if ($i !== $pager_max) {
// Add an ellipsis if there are further previous pages.
if ($i > 1) {
$variables['ellipses']['previous'] = TRUE;
}
// Now generate the actual pager piece.
for (; $i <= $pager_last && $i <= $pager_max; $i++) {
$options = [
'query' => pager_query_add_page($parameters, $element, $i - 1),
'query' => $pager_manager->getUpdatedParameters($parameters, $element, $i - 1),
];
$items['pages'][$i]['href'] = \Drupal::url($route_name, $route_parameters, $options);
if ($i == $pager_current) {
$items['pages'][$i]['href'] = Url::fromRoute($route_name, $route_parameters, $options);
if ($i === $pager_current) {
$variables['current'] = $i;
}
}
Expand All @@ -1107,18 +1112,18 @@ function gent_base_preprocess_pager(&$variables) {
if ($pager_page_array[$element] < ($pager_max - 1)) {
$items['next'] = [];
$options = [
'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] + 1),
'query' => $pager_manager->getUpdatedParameters($parameters, $element, $pager_page_array[$element] + 1),
];
$items['next']['href'] = \Drupal::url($route_name, $route_parameters, $options);
$items['next']['href'] = Url::fromRoute($route_name, $route_parameters, $options);
if (isset($tags[3])) {
$items['next']['text'] = $tags[3];
}

$items['last'] = [];
$options = [
'query' => pager_query_add_page($parameters, $element, $pager_max - 1),
'query' => $pager_manager->getUpdatedParameters($parameters, $element, $pager_max - 1),
];
$items['last']['href'] = \Drupal::url($route_name, $route_parameters, $options);
$items['last']['href'] = Url::fromRoute($route_name, $route_parameters, $options);
if (isset($tags[4])) {
$items['last']['text'] = $tags[4];
}
Expand Down Expand Up @@ -1248,7 +1253,7 @@ function gent_base_preprocess_vesta(&$variables) {
$variables['related'] = [];

/* @var $keyword Gent\Services\Vesta\Value\Keyword */
$termStorage = \Drupal::entityManager()->getStorage('taxonomy_term');
$termStorage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
foreach ($entity->getVestaValue()->getKeywords() as &$keyword) {
$terms = $termStorage->loadByProperties([
'field_vesta_id' => $keyword->getId(),
Expand Down Expand Up @@ -1302,7 +1307,7 @@ function gent_base_preprocess_links__language_block(&$variables) {
->getCurrentLanguage()
->getId();

if (isset($currentLanguageCode)) {
if ($currentLanguageCode) {
$variables['current_language_code'] = $currentLanguageCode;
}

Expand All @@ -1312,7 +1317,7 @@ function gent_base_preprocess_links__language_block(&$variables) {

/** @var \Drupal\language\Entity\ConfigurableLanguage $linkLanguage */
$linkLanguage = $link['link']['#options']['language'];
if ($currentLanguageCode == $linkLanguage->get('id')) {
if ($currentLanguageCode === $linkLanguage->get('id')) {
unset($variables['links'][$i]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
"private": true,
"dependencies": {
"@digipolis-gent/modal": "^1.0.3",
"gent_styleguide": "^4.0.2"
"gent_styleguide": "^4.1.0"
}
}
11 changes: 11 additions & 0 deletions source/sass/11-base/toolbar/_toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,14 @@ body {
font-family: inherit;
}
}

// Fix fonts on logged in pages.
body[class*='icon-'] {
font-family: inherit;
font-style: inherit;
font-variant: inherit;
font-weight: inherit;
text-decoration: inherit;
text-transform: inherit;
speak: inherit;
}
Loading

0 comments on commit 35a0c7b

Please sign in to comment.