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'm working on porting Browsersync to Drupal 8, and also willing to help maintain the module. I will post patches here for the time being, please let me know if you'd like a co-maintainer. Note that it would be at least partially sponsored by my employer so I would want to add my employer as a Supporting Organization on the project page via the built-in mechanism there.
Comment | File | Size | Author |
---|---|---|---|
#24 | interdiff.txt | 667 bytes | star-szr |
#24 | port_to_drupal_8-2596637-24.patch | 14.29 KB | star-szr |
#22 | interdiff.txt | 5.11 KB | star-szr |
#22 | port_to_drupal_8-2596637-22.patch | 13.88 KB | star-szr |
#19 | interdiff.txt | 382 bytes | star-szr |
Comments
Comment #2
star-szrIssue summary update.
Comment #3
jorgegc CreditAttribution: jorgegc as a volunteer commentedHi @Cottser,
Porting the module to D8 is definitely on the roadmap, it just so happens that it isn't on the module's page :-) I am definitely keen on the idea and I don't see a problem in giving credits to your employer for your work. Ping me on IRC and we will chat about it a bit more.
Thanks!
Comment #4
star-szrPinged :) timezones are hard. I probably won't be online tonight (roughly 12 hours from now) and will be travelling a good chunk of tomorrow.
Comment #5
jorgegc CreditAttribution: jorgegc as a volunteer commentedThey are hard, indeed "Cottser commented about 12 hours ago" :-) I am sure we will find some time though.
Comment #6
star-szrI realized I said I'd post patches and I haven't posted a patch yet, and people have been pinging me about this.
Here's a very minimal port (no settings support, it's either on or off, I commented out things to be addressed later). Patch is against 7.x-1.x-dev (7.x-1.1).
Comment #8
jorgegc CreditAttribution: jorgegc as a volunteer commentedNo worries @Cottser, I will review it as soon as I can. I should probably create a 8.x-1.x branch to avoid any problems.
Comment #9
askibinski CreditAttribution: askibinski at Merge commentedPatch works great, although I had to rename the *.tpl.php file manually to *.html.twig and also the 'theme' folder into 'templates'.
Also cleaned up some D7 files.
Attached is the complete module with these changes based on the patch by Cottser, would be great to see a Drupal 8 branch :)
Comment #10
star-szrThe patch does all those things, for the record :) thanks and glad it works for you.
Comment #11
jorgegc CreditAttribution: jorgegc as a volunteer commentedHi @Cottser, patch looks good thanks. I can confirm it embeds the snippet and it also renames the template file and the folder it lives in. I have created a 8.x-1.x branch off the current 7.x-1.x (7.x-1.1).
Hey @askibinski, thanks for the zip file but Cottser has volunteered to work on this issue (see it assigned to him) and ideally we would like to work with .patch files as they are easier to apply to the development branch the test. At the moment we probably need people to test the module and give us feedback. If you wanted to help that would be great :-)
Comment #12
askibinski CreditAttribution: askibinski at Merge commentedYes I know, applying the patch in phpstorm/git did the trick. Apparently the old method using patch command without a git repo doesn't perform the rename/remove actions.
Anyway, patch applies cleanly and works for me. Will report if I find any issues with it.
Comment #13
star-szr@jorgegc thanks for creating the branch, looks like I missed your IRC ping by a few hours :( timezones--
I'm looking at porting the settings and permissions now.
Comment #14
star-szrWork in progress (obeys permissions and integrates with theme settings forms), not sure how correct the CMI stuff is but it seems to work :)
Comment #15
star-szrOne thing I think is technically available again (in addition to the UI) is setting these values via a settings.php/settings.local.php file but still need to test it.
Comment #16
jorgegc CreditAttribution: jorgegc as a volunteer commentedI honestly don't know how to test the settings override in settings.php/settings.local.php so if you could shed some light that would be awesome. I have tested the permissions and settings forms and they seem to work fine, great work. I've got one tiny comment about the code though:
What are you planning on tackling next? Tests?
Comment #17
star-szrGood catch @jorgegc :) fixed that and a couple other things here. It looks like as soon as you add fields to the theme settings form they are saved with the theme settings whether you like it or not so the whole third_party_settings thing seems unnecessary and redundant at this point, removed.
Yes, tests are up next for sure, I think that's the only thing left.
In the meantime here's the syntax to test the settings.php overrides. We're not doing anything special to get this, just a built-in CMI feature:
Comment #18
star-szrOh and there's probably no better time to convert to short array syntax!
Comment #19
star-szrAnd also it dawned on me that hook_form_system_theme_settings_alter() is technically only for themes although it emulates a hook_form_FORM_ID_alter(). See color_form_system_theme_settings_alter() and #943212: hook_form_system_theme_settings_alter() vs. THEME_form_system_theme_settings_alter() name-clash.
Comment #20
jorgegc CreditAttribution: jorgegc as a volunteer commentedHi @Cottser, I tested the overrides and I can confirm this feature is available again. Also, I noticed that you fixed the PHP warnings, cheers for that.
The short array syntax is very welcome, nice one! Oh and thanks for the heads up, I wasn't aware of that issue. Following it now!
Please keep the patches coming, I am looking forward to seeing this module ported.
Comment #21
jorgegc CreditAttribution: jorgegc as a volunteer commentedForgot to change the status. Let's tackle tests next.
Comment #22
star-szrShort version: Config schema added back, D7 test ported. I added one more basic assertion and this could be expanded later to add more tests (like for the UI and other settings).
Didn't expect this but I think that the test is showing that we need to have a config schema after all. I think there is actually a core issue because of this. The theme settings form shouldn't just save everything that's added to its form, otherwise the theme settings config schema will end up incomplete/mismatched. I'll try to find an issue for that or create one.
Without adding back the config schema when you try to save the config in the test:
You get this:
@jorgegc I didn't see any PHP warnings before so if this reintroduces them please paste them in here. I think I have all the error reporting cranked up but could be something I was doing differently too :)
Comment #23
star-szrComment #24
star-szrOops :)
Comment #25
jorgegc CreditAttribution: jorgegc as a volunteer commentedSorry @Cottser it has been a crazy week and I haven't had time to have a look at the latest patches. Please bear with me, I will try and find some time this week.
Comment #26
star-szr@jorgegc no worries it happens! Thanks for the update.
Comment #27
star-szrBy the way this is how to do the settings.php overrides with the latest code:
Comment #28
star-szrYou can also enable Browsersync for all users, very cool :) <3 CMI
$config['user.role.anonymous']['permissions'][] = 'use browsersync';
$config['user.role.authenticated']['permissions'][] = 'use browsersync';
Edit: Hmm maybe nevermind on that one.
Comment #29
joelpittetJust a note for both versions, but more so for the D8 version as we are HTML5. You don't need to add
type
attribute for JavaScript @see http://stackoverflow.com/questions/5265202/do-you-need-text-javascript-s..., and CDATA is not needed for the HTML5 world (was there to pass XHTML well formed XML validation).Comment #30
star-szr@joelpittet 100% agree but thought it was out of scope. Can be addressed once we have a commit on 8.x-1.x IMO :) Thanks!
Comment #31
jorgegc CreditAttribution: jorgegc as a volunteer commentedHey @Cottser,
Have you addressed all the issues that you were having with the CMI? I saw you trying to resolve some issues to do with duplicates on IRC the other day. I have tested the module and everything seems to work, including the settings overrides and tests.
Agree with both you and @joelpittet regarding the snippet. We can definitely address that in a separate issue.
Cheers
Comment #32
star-szr@jorgegc yes I think I've done all I can without stepping on core's toes, so this should be ready to go. To prevent the redundant data from being saved into theme settings the core bug at #2623146: theme_settings_convert_to_config() shouldn't save unknown keys into theme configuration objects needs to be fixed and @joelpittet seems to agree on the path forward there and it's really a generic core issue with anyone altering the theme settings form. I'll probably work on a patch and tests for that bug in the near future if someone else doesn't beat me to it.
So in short, this is ready to roll from my perspective. Once the core bug is fixed we shouldn't need to change anything, either.
Comment #33
jorgegc CreditAttribution: jorgegc as a volunteer commentedI will commit it today when I get home. Thanks @Cottser!
Comment #35
jorgegc CreditAttribution: jorgegc as a volunteer commentedComment #36
star-szrThanks, good news! Commit authorship (in git) would be appreciated next time but no big deal. We haven't yet gotten a chance to catch up on IRC but my offer for co-maintaining the 8.x branch still stands :)
Comment #37
jorgegc CreditAttribution: jorgegc as a volunteer commentedSorry I've screwed it up Cottser! On a much more positive note, I have added Digital Echidna as a supporting organisation for having "sponsored port to Drupal 8". Please let me know if this need to be amended.
Also, let's try and find some time to chat on IRC. I really appreciate your help and all the effort you have put into porting this module to D8. I guess I just need some guidance from someone more experienced in the issue queue to ensure I am doing the right thing. Cheers
Comment #38
star-szr@jorgegc looks good thanks! I thought I had just caught you in IRC but didn't look closely enough at the timestamp.