Skip to content

Commit

Permalink
Fix code deprecations (#269)
Browse files Browse the repository at this point in the history
* Fix code deprecations #268

* Test against LGD 2.x with Drupal 9 and LGD 3.x with Drupal 10
  • Loading branch information
stephen-cox committed Jul 17, 2023
1 parent c675bc8 commit c2c1314
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 32 deletions.
56 changes: 28 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
strategy:
fail-fast: false
matrix:
localgov-version:
- '2.x'
drupal-version:
- '~9.3'
php-version:
- '7.4'
- '8.1'
include:
- localgov-version: '2.x'
drupal-version: '~9.4'
php-version: '8.1'
- localgov-version: '3.x'
drupal-version: '~10.0'
php-version: '8.1'

steps:

Expand Down Expand Up @@ -108,13 +108,13 @@ jobs:
strategy:
fail-fast: false
matrix:
localgov-version:
- '2.x'
drupal-version:
- '~9.3'
php-version:
- '7.4'
- '8.1'
include:
- localgov-version: '2.x'
drupal-version: '~9.4'
php-version: '8.1'
- localgov-version: '3.x'
drupal-version: '~10.0'
php-version: '8.1'

steps:

Expand Down Expand Up @@ -144,13 +144,13 @@ jobs:
strategy:
fail-fast: false
matrix:
localgov-version:
- '2.x'
drupal-version:
- '~9.3'
php-version:
- '7.4'
- '8.1'
include:
- localgov-version: '2.x'
drupal-version: '~9.4'
php-version: '8.1'
- localgov-version: '3.x'
drupal-version: '~10.0'
php-version: '8.1'

steps:

Expand Down Expand Up @@ -179,13 +179,13 @@ jobs:
strategy:
fail-fast: false
matrix:
localgov-version:
- '2.x'
drupal-version:
- '~9.3'
php-version:
- '7.4'
- '8.1'
include:
- localgov-version: '2.x'
drupal-version: '~9.4'
php-version: '8.1'
- localgov-version: '3.x'
drupal-version: '~10.0'
php-version: '8.1'

steps:

Expand Down
3 changes: 2 additions & 1 deletion src/Controller/AlertBannerEntityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public function revisionOverview(AlertBannerEntityInterface $localgov_alert_bann
$latest_revision = TRUE;

foreach (array_reverse($vids) as $vid) {
/** @var \Drupal\localgov_alert_banner\AlertBannerEntityInterface $revision */
/** @var \Drupal\localgov_alert_banner\Entity\AlertBannerEntityInterface $revision */
// @phpstan-ignore-next-line.
$revision = $localgov_alert_banner_storage->loadRevision($vid);
// Only show revisions that are affected by the language that is being
// displayed.
Expand Down
1 change: 1 addition & 0 deletions src/Form/AlertBannerEntityRevisionDeleteForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public function buildForm(array $form, FormStateInterface $form_state, AlertBann
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// @phpstan-ignore-next-line.
$this->alertBannerEntityStorage->deleteRevision($this->revision->getRevisionId());

$this->logger('content')->notice('Alert banner: deleted %title revision %revision.', [
Expand Down
7 changes: 4 additions & 3 deletions src/Plugin/Block/AlertBannerBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,17 @@ protected function getCurrentAlertBanners() {
}

// Continue alert banner query.
$published_alert_banner_query->sort('changed', 'DESC')
->accessCheck(TRUE);
$published_alert_banner_query->sort('changed', 'DESC');

// If types (bunldes) are selected, add filter condition.
if (!empty($types)) {
$published_alert_banner_query->condition('type', $types, 'IN');
}

// Execute alert banner query.
$published_alert_banners = $published_alert_banner_query->execute();
$published_alert_banners = $published_alert_banner_query
->accessCheck(TRUE)
->execute();

// Load alert banners and add all.
// Visibility check happens in build, so we get cache contexts on all.
Expand Down

0 comments on commit c2c1314

Please sign in to comment.