TypeError: book_moderation_sync_help(): Argument #2 ($route_match) must be of type RouteMatchInterface

Created on 6 January 2025, 4 months ago

Facing below issue after installing the Book Moderation Sync module.

TypeError: book_moderation_sync_help(): Argument #2 ($route_match) must be of type RouteMatchInterface, Drupal\Core\Routing\CurrentRouteMatch given, called in /core/modules/help/src/Plugin/Block/HelpBlock.php on line 96 in book_moderation_sync_help() (line 12 of modules/contrib/book_moderation_sync/book_moderation_sync.module).

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇮🇳India revathi.b

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @revathi.b
  • 🇫🇷France estoclet

    Subject: Issue Resolved in Latest Version

    Hello [User's Name],

    Thank you for reporting this issue. We have investigated the problem and are happy to inform you that it has been resolved in the latest version of the Book Moderation Sync module.

    Details of the Fix

    The error you encountered was due to a type mismatch in the book_moderation_sync_help function. Specifically:

    • The function expected an argument of type RouteMatchInterface.
    • However, an object of type Drupal\Core\Routing\CurrentRouteMatch was being passed, causing a TypeError.

    In the latest version of the module, this issue has been fixed by ensuring that the book_moderation_sync_help function is correctly typed and compatible with CurrentRouteMatch. Here is the relevant part of the updated code:

    function book_moderation_sync_help($route_name, RouteMatchInterface $route_match) {
      switch ($route_name) {
        case 'help.page.book_moderation_sync':
          return '<p>' . t('Synchronizes moderation states between books and their children.') . '</p>';
      }
    }

    Next Steps

    1. Update the Module:
      • If you haven't already, please update to the latest version of the Book Moderation Sync module (1.0.0-beta6 or later).
      • You can download the latest release from the project page .
    2. Clear Cache:
      • After updating the module, clear the Drupal cache to ensure that the changes take effect. You can do this by navigating to Administration > Configuration > Performance and clicking "Clear all caches."
    3. Verify the Fix:
      • Test the module's functionality, especially the help page (/admin/help/book_moderation_sync), to confirm that the issue no longer occurs.

    If the Issue Persists

    If you continue to experience issues after updating the module, please:

    • Provide detailed steps to reproduce the problem.
    • Share any error messages or logs you encounter.
    • Confirm the versions of Drupal core and the module you are using.

    We appreciate your feedback and are here to help if you encounter any further problems.

    Best regards,

Production build 0.71.5 2024