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

Category:Bug report» Support request
Issue summary:View changes
Status:Active» Fixed

Reading the following part from hook_libraries_info() should make is sufficiently clear.

* - pre-dependencies-load: Callbacks registered in this group are applied
* directly before the library's dependencies are loaded. At this point
* the library contains variant-specific information, if specified. Note
* that in this group the 'variants' property is no longer available.
* - pre-load: Callbacks registered in this group are applied directly after
* the library's dependencies are loaded and before the library itself is
* loaded.
* - post-load: Callbacks registered in this group are applied directly
* after this library is loaded. At this point, the library contains a
* 'loaded' key, which contains the number of files that were loaded.

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!

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.