Drupal 10 Compatible Version

Created on 2 August 2023, over 1 year ago
Updated 12 September 2024, 2 months ago

Problem/Motivation

No official Drupal 9 or 10 compatible release yet. The last available official release is up to Drupal 8 compatible and there have been several deprecated codes that aren't compatible with Drupal 10 and/or Drupal 9. Drupal 9 is near its EOL and still not even a D9 compatible release. All the focus should be now on a Drupal 10 fully compatible release and looking forwards to a Drupal 11 one afterwards.

Proposed resolution

I share here a patch I created from the diff against the latest official release 8.x-1.0 ā†’ . This includes patches made up to D9 compatible from this issue šŸ“Œ Drupal 9 compatibility RTBC and other fixes I made for D10 compatibility as well as fixing the broken help link issue. My contributions are mainly in the files:

  • src\Form\SettingsForm.php - replaced the deprecated taxonomy_vocabulary_get_names() function which was giving a php error on accessing admin/config/content/hashtags/settings_form
  • hashtags.module
    • Replaced the deprecated function drupal_get_path() in the hashtags_help() function which was giving php error on accessing the module help at admin/help/hashtags
    • Replaced the deprecated method \Drupal::toUrl() .
    • Fixed the broken paths to the help images.
  • hashtags.info.yml - added support for Drupal 10
  • README.txt renamed to README.md

I tested all features and functionality of the fixed module and all is good for me with no errors logged on my latest Drupal 10.1.1 install.

Remaining tasks

Test if working to enable the module using Drush instead of UI.
Using Drush en hashtags while enabled the module but broke the site. More on this later after I re-test.

IMPORTANT NOTES: Please make sure to have a DB backup before trying to install/enable the module via Drush. The only way I could install it before making the changes above was via UI while Drush caused site to break.

ALSO: make sure to FIRST read the README file for steps to do before you try to uninstall the module if you had to. You need to disable the hashtags filter in both Basic HTML and Full HTML text formats before disabling/uninstalling the module.

User interface changes

API changes

All commented in the files mentioned above.

Data model changes

šŸ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

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

Comments & Activities

  • Issue created by @cestmoi
  • Status changed to Needs review over 1 year ago
  • @ Maintainer(s), this is my first such patch so kindly correct me where applicable.

  • Status changed to Closed: duplicate over 1 year ago
  • šŸ‡®šŸ‡³India keshavv India

    Thank you @cestmoi for your efforts.
    But there is already an issue for it https://www.drupal.org/project/hashtags/issues/3127386 šŸ“Œ Drupal 9 compatibility RTBC

  • Status changed to Needs review over 1 year ago
  • @keshav.k thank you but that issue is for D9 not D10 and while D9 is near its EOL shouldn't efforts be on a stable D10 version ? This issue is mainly for D10 compatibility while that issue has no mention of D10. I also added fixes for issues that weren't tackled in that other issue. Anyways, I just hope this module gets the attention it needs esp. that its latest release is only D8 compatible.

  • With regards to the module install/enable via Drush vs UI, I think since the module cannot be required with Composer due to absence of a compatible release and it has to be added manually, installing it via Drush would cause errors such as the one below because Drush uses the Composer autoloader to load classes, and if the module is not listed in the composer.json file, its classes won't be found. That's why it installs fine via admin UI but not via Drush.

    Drupal\Component\Plugin\Exception\PluginException: Plugin (filter_hashtags) instance class "Drupal\hashtags\Plugin\Filter\FilterHashtags" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of pathToDrupal-10\web\core\lib\Drupal\Component\Plugin\Factory\DefaultFactory.php).

    That's why until there is a compatible release that can be required with Composer, the only way to enable the module is via admin UI, I understand.

    I tried to `Composer require` it with the patch following this (D8/D9) tutorial but it didn't work.

  • Issue was unassigned.
  • I think this patch is ready for RTBC. Please test and report so we have a D10 release sooner.

  • Same patch, just renamed the file per known standards.

  • Assigned to cleavinjosh
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    I'll try to review this.

  • Issue was unassigned.
  • Status changed to RTBC 2 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @cestmoi,

    Thank you for providing a patch.

    My Drupal Version is 10.3.2

    At first when I cloned the module. The website encountered an error.

    I then applied patch #3, it was applied smoothly and fixed the error.

    āžœ  hashtags git:(8.x-1.0) curl https://www.drupal.org/files/issues/2023-08-03/hashtags-d10-compatibility-3378603.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 26584  100 26584    0     0  58758      0 --:--:-- --:--:-- --:--:-- 58684
    patching file hashtags.info.yml
    patching file hashtags.install
    patching file hashtags.module
    patching file src/Form/ManagerForm.php
    patching file src/Form/SettingsForm.php
    patching file src/Plugin/Filter/FilterHashtags.php
    āžœ  hashtags git:(8.x-1.0) āœ—

    Afterwards, I installed the module successfully.

    I then go to the help page and followed the instructions on how to use the module.

    I go to the hashtag configuration page and enabled the hashtag in the Article content type.

    I then create an article page with two lines in the body, one with hashtag and one without.

    I then save the page and the line with the "#" is displayed as a link.

    Clicking the link will redirect to the taxonomy term's page.

    Please let me know if I missed something or did something wrong during testing.

    For now, I am changing the status to RTBC since the module is working without any errors.

    Thank you.

Production build 0.71.5 2024