Loading README.md +2 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,8 @@ Modules that implement the API: - ActivityPub: https://www.drupal.org/project/activitypub - IndieWeb Microsub: https://www.drupal.org/project/indieweb Note: only works using the internal Microsub endpoint. - Reader module on behalf of Aggregator in Drupal core. - Reader module on behalf of Aggregator for D9 and https://www.drupal.org/project/aggregator for D10. ## Install Loading reader.info.yml +4 −1 Original line number Diff line number Diff line type: module name: Reader description: 'PWA reader' core_version_requirement: ^8.8 || ^9 core_version_requirement: ^9.4 || ^10 test_dependencies: - aggregator:aggregator - stable:stable reader.module +19 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,25 @@ function reader_preprocess_links__reader_actions(&$variables) { } } /** * Returns all modules which implement hook_reader_channels. * * We use this simple function as it's needed in a couple of places and would * lead to a lot of custom helper functions in the classes. * * @param string $hook * The hook which we want the implementors for. * * @return array */ function reader_get_implementators(string $hook = 'reader_channels') { $implementors = []; \Drupal::moduleHandler()->invokeAllWith($hook, function (callable $hook, string $module) use (&$implementors) { $implementors[] = $module; }); return $implementors; } /** * Implements hook_reader_channels(). * Loading reader.routing.yml +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ reader.add: _entity_form: 'node.reader-add' _title_callback: '\Drupal\node\Controller\NodeController::addPageTitle' requirements: _node_add_access: 'node:{node_type}' _entity_create_access: 'node:{node_type}' options: _reader_theme: 'reader_theme' _node_operation_route: TRUE Loading src/Controller/ReaderController.php +3 −5 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; /** * */ class ReaderController extends ControllerBase { /** Loading Loading @@ -85,7 +82,7 @@ class ReaderController extends ControllerBase { $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::service('extension.list.theme')->getPath('reader_theme') . '/images/icon.png'), 'sizes' => '192x192', 'type' => 'image/png', ]; Loading Loading @@ -132,7 +129,7 @@ class ReaderController extends ControllerBase { if ($op == 'list' && $module == '_reader_sources_list_') { $sources = []; foreach ($this->moduleHandler()->getImplementations('reader_channels') as $module) { foreach (reader_get_implementators() as $module) { $function = $module . '_reader_channels'; if (function_exists($function)) { $data = $function(); Loading Loading @@ -506,6 +503,7 @@ class ReaderController extends ControllerBase { $query = $this->entityTypeManager()->getStorage($entity_type_id) ->getQuery() ->accessCheck() ->pager($limit); if ($type == 'content') { $query->condition('uid', $this->currentUser()->id()); Loading Loading
README.md +2 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,8 @@ Modules that implement the API: - ActivityPub: https://www.drupal.org/project/activitypub - IndieWeb Microsub: https://www.drupal.org/project/indieweb Note: only works using the internal Microsub endpoint. - Reader module on behalf of Aggregator in Drupal core. - Reader module on behalf of Aggregator for D9 and https://www.drupal.org/project/aggregator for D10. ## Install Loading
reader.info.yml +4 −1 Original line number Diff line number Diff line type: module name: Reader description: 'PWA reader' core_version_requirement: ^8.8 || ^9 core_version_requirement: ^9.4 || ^10 test_dependencies: - aggregator:aggregator - stable:stable
reader.module +19 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,25 @@ function reader_preprocess_links__reader_actions(&$variables) { } } /** * Returns all modules which implement hook_reader_channels. * * We use this simple function as it's needed in a couple of places and would * lead to a lot of custom helper functions in the classes. * * @param string $hook * The hook which we want the implementors for. * * @return array */ function reader_get_implementators(string $hook = 'reader_channels') { $implementors = []; \Drupal::moduleHandler()->invokeAllWith($hook, function (callable $hook, string $module) use (&$implementors) { $implementors[] = $module; }); return $implementors; } /** * Implements hook_reader_channels(). * Loading
reader.routing.yml +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ reader.add: _entity_form: 'node.reader-add' _title_callback: '\Drupal\node\Controller\NodeController::addPageTitle' requirements: _node_add_access: 'node:{node_type}' _entity_create_access: 'node:{node_type}' options: _reader_theme: 'reader_theme' _node_operation_route: TRUE Loading
src/Controller/ReaderController.php +3 −5 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; /** * */ class ReaderController extends ControllerBase { /** Loading Loading @@ -85,7 +82,7 @@ class ReaderController extends ControllerBase { $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::service('extension.list.theme')->getPath('reader_theme') . '/images/icon.png'), 'sizes' => '192x192', 'type' => 'image/png', ]; Loading Loading @@ -132,7 +129,7 @@ class ReaderController extends ControllerBase { if ($op == 'list' && $module == '_reader_sources_list_') { $sources = []; foreach ($this->moduleHandler()->getImplementations('reader_channels') as $module) { foreach (reader_get_implementators() as $module) { $function = $module . '_reader_channels'; if (function_exists($function)) { $data = $function(); Loading Loading @@ -506,6 +503,7 @@ class ReaderController extends ControllerBase { $query = $this->entityTypeManager()->getStorage($entity_type_id) ->getQuery() ->accessCheck() ->pager($limit); if ($type == 'content') { $query->condition('uid', $this->currentUser()->id()); Loading