Skip to content
Snippets Groups Projects
Commit ded1dfb6 authored by Tiago's avatar Tiago
Browse files

Issue #3375021 by slowflyer, Grevil, Anybody, tbsiqueira: Drupal 10 compatibility fixes

parent 2090ac55
No related branches found
No related tags found
No related merge requests found
name: Activity Send Web Push
type: module
description: Used to send activity notifications by Web Push
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^9 || ^10
package: Social
dependencies:
- activity_send
......@@ -144,7 +144,7 @@ class PushActivitySend extends ActivitySendBase implements ContainerFactoryPlugi
$file = File::load($fid);
$path = $file->createFileUrl(FALSE);
$push_data['icon'] = file_url_transform_relative($path);
$push_data['icon'] = \Drupal::service('file_url_generator')->transformRelative($path);
}
// Encode payload.
......
name: 'Social PWA'
description: 'Makes the website "Installable" like an App on smartphones and enhances it with Service Workers for the use of Push Notifications and an Offline User Experience.'
type: module
core_version_requirement: ^8 || ^9
core_version_requirement: ^9 || ^10
package: Social
configure: social_pwa.settings
dependencies:
......
......@@ -48,13 +48,13 @@ function social_pwa_page_attachments(array &$page) {
// Icon support for Chrome on Android.
'rel' => 'icon',
'sizes' => '256x256',
'href' => file_url_transform_relative(ImageStyle::load('social_pwa_icon_256')->buildUrl($path)),
'href' => \Drupal::service('file_url_generator')->transformRelative(ImageStyle::load('social_pwa_icon_256')->buildUrl($path)),
];
$page['#attached']['html_head_link'][][] = [
// Icon support for Safari on iOS.
'rel' => 'apple-touch-icon',
'sizes' => '180x180',
'href' => file_url_transform_relative(ImageStyle::load('social_pwa_icon_180')->buildUrl($path)),
'href' => \Drupal::service('file_url_generator')->transformRelative(ImageStyle::load('social_pwa_icon_180')->buildUrl($path)),
];
// Attach the main.js and sw.js in the render array.
......@@ -124,7 +124,7 @@ function social_pwa_page_attachments(array &$page) {
'#tag' => 'meta',
'#attributes' => [
'name' => 'msapplication-TileImage',
'content' => file_url_transform_relative(ImageStyle::load('social_pwa_icon_144')->buildUrl($path)),
'content' => \Drupal::service('file_url_generator')->transformRelative(ImageStyle::load('social_pwa_icon_144')->buildUrl($path)),
],
],
'msapplication-TileColor' => [
......
......@@ -69,7 +69,7 @@ class ManifestOutputController extends ControllerBase {
foreach ($image_styles as $key => $value) {
$config_value[] = [
'src' => file_url_transform_relative(ImageStyle::load($key)->buildUrl($path)),
'src' => \Drupal::service('file_url_generator')->transformRelative(ImageStyle::load($key)->buildUrl($path)),
'sizes' => $value,
'type' => 'image/png',
];
......
......@@ -19,7 +19,7 @@ class ServiceWorkerController extends ControllerBase {
* Return response.
*/
public function serviceWorker() {
$path = drupal_get_path('module', 'social_pwa');
$path = \Drupal::service('extension.list.module')->getPath('social_pwa');
$sw = file_get_contents($path . '/js/sw.js');
return new Response($sw, 200, [
......
......@@ -84,6 +84,7 @@ class PushNotificationForm extends FormBase {
->getStorage('user')
->getQuery()
->condition('uid', 0, '>')
->accessCheck()
->execute();
$push_enabled_users = [];
......@@ -176,7 +177,7 @@ class PushNotificationForm extends FormBase {
$file = File::load($fid);
$path = $file->createFileUrl(FALSE);
$push_data['icon'] = file_url_transform_relative($path);
$push_data['icon'] = \Drupal::service('file_url_generator')->transformRelative($path);
}
$serialized_payload = (new WebPushPayload('legacy', $push_data))->toJson();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment