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.
I wanted to try out behavior_weights with tinynav so I wrote some code to allow it.
I just switched to using Drupal behaviors and added the weight.
It's seems slightly more elegant like this anyway.
Comment | File | Size | Author |
---|---|---|---|
#3 | tinynav-behavior_weights-1937858-3.patch | 2.65 KB | Jaesin |
#1 | tinynav-behavior_weights-1937858-1.patch | 2.06 KB | Jaesin |
tinynav-behavior_weights.patch | 1.52 KB | Jaesin |
Comments
Comment #1
Jaesin CreditAttribution: Jaesin commentedI forgot to add the new "tininav.js" file to the patch.
This should be applied to the 7.x-1.0-dev branch.
Comment #2
btopro CreditAttribution: btopro commentedI agree this is much more elegant (at a glance). I'll take a look at rolling it next week but some further testing from the community would be nice as well. Also not sure that the added js file should be called tinynav.js as that's the name of the jquery library being pulled in. Maybe something like tinynav-integration.js or something to suggest by looking at the files that this is just the integration of the library, the fork is the forked library allowed to be included / built off of and that someone implementing the original library would be tinynav.js (or tinynav.min.js).
So, next steps. Reroll patch with different name for .js file, get testing from someone other then you and I and I think we're RTBC. Nice patch.
Comment #3
Jaesin CreditAttribution: Jaesin commentedI added some comments to the js file and changed the name to tinynav-drupal.js .
tinynav-drupal.js is also adding a div wrapper to the select element. This is often needed for creating custom dropdowns for a select elements with CSS.
The Additional code:
Comment #4
btopro CreditAttribution: btopro commentedCommitted a modified version of your patch. It has true and "flase" as strings and needed to be boolean on the php side. the drupal file was also spelled wrong and there was minor logistical flaws in the handling of active and header which rendered them broken.
I fixed these small issues in the patch and committed it as two commits
updates to a behaviors based approach -- http://drupalcode.org/project/tinynav.git/commit/afd1ac9
updates to tinynav fork -- http://drupalcode.org/project/tinynav.git/commit/c4f4b0d
Comment #5
Jaesin CreditAttribution: Jaesin commentedCool, now if someone is having issues with load order, they will just need to install behavior_weights to make sure tinynav loads last.
Comment #6
btopro CreditAttribution: btopro commentedIf that's the OP we could also just apply the drupal_add_js call with a lower weight, there's no reason for it to fire before things that would potentially cause an issue but that can be resolved in another thread if that's a feature desired.