Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We should use composer to install the geshi library instead of the libraries module because it's the way how we install modules in drupal 8.
The geshi library is already available as a composer package: https://github.com/GeSHi/geshi-1.0/blob/master/composer.json
So it should be as easy as adding a composer.json file to the module and require geshi/geshi
.
For more information see https://www.drupal.org/docs/8/creating-custom-modules/add-a-composerjson....
Here is a proposed composer.json file:
{
"name": "drupal/geshi",
"description": "Provides a filter to highlight source code using the GeSHi library (Generic Syntax Highlighter).",
"type": "drupal-module",
"license": "GPL-2.0+",
"require": {
"geshi/geshi": "dev-master"
}
}
Comments
Comment #2
bahuma20Comment #3
yukare CreditAttribution: yukare commentedThis is good, and it is more simple to use than download the library, but i do not think that we must drop support for downloading the library by hand in flavor of composer. Some may not have access do composer(some hosts do not have ssh access).
We now load the geshi using the libraries module. We could change to use composer, and make it the recommended way, but if it is not available, try to load the geshi from the same way we do now.
It may be simple to do: replace the calls to libraries_load() we have now to calls to a function we create, this function tries to include geshi(the one from composer), if it fails, try to load from libraries(if it is available, because we can remove the libraries module as a requeriment).
Comment #5
yukare CreditAttribution: yukare commentedThis commit do some changes:
composer require geshi/geshi:dev-master
to install the geshi library, no need to use the libraries module in this case.composer require drupal/geshifilter
will install the module and the library with composer1 and 2 are working now. I need this commit so i can test 3, but it should work. Need to update the readme file with this instructions(but the readme file need other changes too).
If you are using the module now it will work without any change, you do not need to change to composer way if you do not want.
Comment #7
yukare CreditAttribution: yukare commentedThe tests are working for both 1 and 2 from before, but i do not use a full composer drupal site, so please, install it with composer and report if something do not work.
The instructions about this need some work, but i have to work on all the readme file.