diff --git a/reader.api.php b/reader.api.php index e55ec68..7fa6966 100644 --- a/reader.api.php +++ b/reader.api.php @@ -104,10 +104,20 @@ function hook_reader_do_post_action($action, $id, array $items) { * - id: id of the channel * - post_id: id of the post */ -function activitypub_reader_post_actions_alter(&$links, $context) { +function hook_reader_post_actions_alter(&$links, $context) { $links[] = [ 'url' => Url::fromRoute('reader.post.action', ['module' => 'custom', 'action' => 'move', 'id' => $context['id,'], 'post_id' => $context['post_id']]), 'title' => 'Move', 'attributes' => ['class' => ['post-action']], ]; } + +/** + * Alter the manifest. + * + * @param array $manifest + * The current manifest. + */ +function hook_reader_manifest_alter(array &$manifest) { + $manifest['name'] = 'My awesome app'; +} diff --git a/src/Controller/ReaderController.php b/src/Controller/ReaderController.php index a274dd4..44869e3 100644 --- a/src/Controller/ReaderController.php +++ b/src/Controller/ReaderController.php @@ -89,15 +89,17 @@ class ReaderController extends ControllerBase { $url = Url::fromRoute('reader.home')->toString(); $manifest = []; $manifest['name'] = 'Reader'; - $manifest['scope'] = $url . '/'; + $manifest['scope'] = $url; $manifest['start_url'] = $url; $manifest['display'] = $pwa_display; $manifest['icons'][] = (object) [ - 'src' => file_create_url(drupal_get_path('theme', 'reader_theme') . '/images/icon.png'), + 'src' => \Drupal::service('file_url_generator')->generateAbsoluteString(drupal_get_path('theme', 'reader_theme') . '/images/icon.png'), 'sizes' => '192x192', 'type' => 'image/png', ]; + \Drupal::moduleHandler()->alter('reader_manifest', $manifest); + return new JsonResponse($manifest); }