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.
The current code is commented out, so we need to actually test that the library exists when the AMP module is enabled
Comment | File | Size | Author |
---|---|---|---|
#6 | amp library requirement.png | 26.62 KB | sidharth_k |
Comments
Comment #2
johnrosswvsu CreditAttribution: johnrosswvsu as a volunteer and at Promet Source commentedHi @mtift,
I have made a patch (plus 1) to check the existence of AMP Library in hook_requirements(). I have especially set the libraries dependency to >= 2.x. This may need more work especially on the pattern of the 'version arguments' in hook_libraries_info(). It will definitely need some improvement (PCRE RegEx!!!!). The file for checking the library version should also be checked if it is the actual file. I will attach two patches: (1) a patch that addresses the task only, (2) and one that addresses the issue and the coding standard.
I hope anyone can move on forward on this task using these preliminary patches that certain needs work.
Thanks.
Comment #3
johnrosswvsu CreditAttribution: johnrosswvsu as a volunteer and at Promet Source commentedPlease note that I have also set the check for the library during runtime only and not during install.
Thanks.
Comment #5
sidharth_k CreditAttribution: sidharth_k commentedThanks for your effort on this @johnrosswvsu But we're not using the hook_libraries_info , libraries etc approach. We're actually using composer manager which does not need all this.
Accordingly we will not be considering your patch for future inclusion -- sorry :-( !
Our approach is that of @mtift in Drupal 8 ( see http://cgit.drupalcode.org/amp/commit/?id=fcec721 )
Accordingly I've simply:
- Uncommented @mtifts preexisting hook_requirements code for Drupal 7 ( http://cgit.drupalcode.org/amp/commit/?id=262c259 )
- changed
drupal_get_library
to a!class_exists
(like in the Drupal 8 implementation)- Added a link to the composer manager homepage on drupal.org
Comment #6
sidharth_k CreditAttribution: sidharth_k commentedHere is a screenshot if the AMP PHP Library requirement is not met.
Comment #7
sidharth_k CreditAttribution: sidharth_k commentedComment #8
sidharth_k CreditAttribution: sidharth_k commentedComment #9
sidharth_k CreditAttribution: sidharth_k commented