Skip to content

Commit

Permalink
Merge pull request #567 from localgovdrupal/fix/1.x/drupal-11-support
Browse files Browse the repository at this point in the history
fix: Drupal 11 support
  • Loading branch information
finnlewis authored Jun 18, 2024
2 parents 3284fc6 + 44fa8d1 commit 59de9d8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion localgov_base.info.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "LocalGov Base"
description: "Base theme for LocalGov Drupal sites."
type: theme
core_version_requirement: ^8.8 || ^9 || ^10
core_version_requirement: ^10.1.3 || ^11
base theme: "stable9"
ckeditor_stylesheets:
- css/base/ckeditor.css
Expand Down
12 changes: 11 additions & 1 deletion localgov_base.theme
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\DeprecationHelper;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\ViewExecutable;

Expand Down Expand Up @@ -69,7 +70,16 @@ function localgov_base_preprocess_page(&$variables) {
continue;
}
$copy = $variables['page'][$region];
$rendered = \Drupal::service('renderer')->renderPlain($copy);

/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$rendered = DeprecationHelper::backwardsCompatibleCall(
currentVersion: \Drupal::VERSION,
deprecatedVersion: '10.3',
currentCallable: fn() => $renderer->renderInIsolation($copy),
deprecatedCallable: fn() => $renderer->renderPlain($copy),
);

$variables['has_' . $region] = strlen(trim(strip_tags($rendered, '<drupal-render-placeholder><embed><hr><iframe><img><input><link><object><script><source><style><video>'))) > 0;
}
$variables['has_sidebars'] = $variables['has_sidebar_first'] || $variables['has_sidebar_second'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "LocalGov Base Test Support"
description: "Things to help test localgov_base that have to live in a module."
type: module
core_version_requirement: ^8.8 || ^9 || ^10
core_version_requirement: ^10.1.3 || ^11
hidden: true

0 comments on commit 59de9d8

Please sign in to comment.