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 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 deprecatedtaxonomy_vocabulary_get_names()function which was giving a php error on accessingadmin/config/content/hashtags/settings_formhashtags.module- Replaced the deprecated function
drupal_get_path()in thehashtags_help()function which was giving php error on accessing the module help atadmin/help/hashtags - Replaced the deprecated method
\Drupal::toUrl(). - Fixed the broken
pathsto the help images.
- Replaced the deprecated function
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
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | tag_page.png | 288.54 KB | cleavinjosh |
| #14 | hashtag_working.png | 1.35 MB | cleavinjosh |
| #14 | hashtag_article_page_configuration_body_field.png | 290.52 KB | cleavinjosh |
| #14 | hashtag_enabled_for_article.png | 205.32 KB | cleavinjosh |
| #14 | hashtag_after_patch_installed_successfully.png | 258.36 KB | cleavinjosh |
Comments
Comment #2
cestmoi commentedComment #3
cestmoi commented@ Maintainer(s), this is my first such patch so kindly correct me where applicable.
Comment #4
cestmoi commentedComment #5
keshavv commentedThank you @cestmoi for your efforts.
But there is already an issue for it https://www.drupal.org/project/hashtags/issues/3127386
Comment #6
cestmoi commented@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.
Comment #7
cestmoi commentedComment #8
cestmoi commentedWith 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.
Comment #9
cestmoi commentedComment #10
cestmoi commentedI think this patch is ready for RTBC. Please test and report so we have a D10 release sooner.
Comment #11
cestmoi commentedSame patch, just renamed the file per known standards.
Comment #12
pallas athena commentedAny update?
Comment #13
cleavinjosh commentedI'll try to review this.
Comment #14
cleavinjosh commentedHi @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.
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.