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 documentation on post-load callbacks states that the callback is invoked with the argument being the libary, version and variant available.
This isn't the case. If you track the logic involved with the call to the post detect hook by the time the hook is invoked the variant and version context have both been lost.
The only way I've been able to get variant/version specific post-detect to work is to define the post-detect callback in the variant/version context and let the array_merge of variant/versions get the right post detect hook invoked.
Comments
Comment #1
tstoecklerReading the following part from hook_libraries_info() should make is sufficiently clear.
Declaring variant-specific callbacks in the 'variants' key is the correct approach, so it seems you've already fixed your problem.
If you think the documentation could be improved in any way, please *do* re-open this. Thanks!