Developer mode ?
Hi i was wondering how to enable developer mode for my drupal 8 site.
I am working with the H5P.Timer module to add timer to questionset as to make it a exam i can't get the Timer to load since i am editing the library.json from questionare directly and this wil not work.
I like to be able to load the timer module in questionare so i can activate my code its all working now (dirty by adding timer.js in the questionare.js) but very sloppy like to integrate it properly the developer of H5P.Timer told to use dev mode but i can only find a way to activate it for drupal7.
Also i Intent to maybe publish this adition via a fork but i am very novice coder so i wonder what are the requirments before i should even submit it ? :)
BV52
Wed, 11/21/2018 - 06:34
Permalink
Hi spacecabbie,Development
Hi spacecabbie,
Development mode is only available for Drupal 7. You can read more about this here.
-BV52
spacecabbie
Fri, 11/23/2018 - 14:54
Permalink
Yep i was afraid of that any
Yep i was afraid of that any advice on how to get this timer module loaded on drupal 8 ? I can add it to libaries in content -> h5p but the questionare module does not load it.
Or can i only do it via directly editing files wich puts me at risk when updating.
otacke
Mon, 11/26/2018 - 10:46
Permalink
Hi spacecabbie!The answer is
Hi spacecabbie!
The answer is basically the same as the one I gave you at github. Libraries are loaded from cache, so when modifying code in the library folder directly, you'll have to clear cache folder first (temp on drupal 7, not sure what's the equivalent on drupal 8), also the browser cache.
And yes, direct modifications on libraries will be overwritten when updating them with the official versions.
Best,
Oliver
spacecabbie
Mon, 11/26/2018 - 11:28
Permalink
I wish that was the answer :)
Yes but its not loading so i figured I needed the dev mode. Thats why i asked here din't want to bother you when the issue might be with H5P.
Din't mean avoid you just follow proper structure.
When manualy editing the files i never get timer.js loaded cache cleared, drupal in dev mode i tried all of them.
So i thought the js files of H5P must be cached as wel somewhere.
I am a bit at loss now.
I loaded the timer.js in drupal under content -> H5P Liberary.
I edited liberary.json at /sites/default/files/h5p/libraries/H5P.QuestionSet-1.15 to load the timer.js
Also placed timer.js in /js dir where questionset.js is as well and point to that directly from the library file.
Never get it to load. I hope you can point me into the correct direction or anyone else.
I am so new at this you can still smell the green paint :) so i must be doing something stupid.
I am learning coding and i did manage to get a nice timer to work with the quiz i am still fine tunning it. (still learning how to get the timer to continue when browser is refreshed.) when i am done i like to share my code.
This code probably is not up to standard so i am scared of offering it on github maybe screwing up the main code as I asked is there a guideline to what the code needs to be before I should submit it ? (to clarify I know how to offer it on github But I like code formating guide as to where it should be placed and how complete it should be. I now have 6 lines of code witch hardly seems enough)
I shall continue in this tread as to not cause confusion again.
Ps. Thanks for being so patient with me and helping out far far beyond any support you might be obliged to give! thanks.
otacke
Mon, 11/26/2018 - 11:57
Permalink
Hi spacecabbie!You should
Hi spacecabbie!
You should maybe check which files are loaded from where using the development console (network tab) that most browsers offer you by pressing F12. You can then check if the browser is loading the files that you modified, or if it's loading from another location -- usually the cache.
As I mentioned, there's a special folder that's used to cache libraries. On WordPress, it's wp-content/uploads/h5p/cachedassets, on drupal 7 it seems to be sites/default/files/h5p/temp. I've never used Drupal 8 for development however (as it doesn't have a dev mode), and so I am not sure what it's called there. Cleaning it up however should force the H5P core to rebuild it from the regular libraries folder.
You should NEVER be afraid of sharing your code on github. Some developers may have forgotton that they were not born as "super stars", but in general, everyone is pretty much aware that your first steps are most likely to be "non standard" ;-)
To make the code look uniform on H5P, we have provided some style guide at https://h5p.org/documentation/for-developers/coding-guidelines. It's not supposed to be the "correct" coding style, just a convention for our project. We also provide a configuration file for eslint. That's a so callled "linter" that can be included in development environments and will instantly give you a hint if your code violates the coding style.
Apart from pure formatting, there are other general best practices of course, and also some particular things for H5P. I assume WE really need to update our documentation and/or add some links to other resources!
Cheers,
Oliver
spacecabbie
Mon, 11/26/2018 - 12:37
Permalink
Thanks for all the info I
Thanks for all the info I double checked everything deleted temp just to be sure but it seems to indeed load exactly from where we think:
https://testsiteurl.com/sites/default/files/h5p/libraries/H5P.QuestionSe...
otacke
Mon, 11/26/2018 - 12:42
Permalink
And what are the contents of
And what are the contents of this file that the browser receives? I don't mean what you put into the file, but what the browser actually uses. The sources tab of the development console will tell you. If it doesn't show your changes, then there must be a separate Drupal cache running, or the browser still has another version in it's own cache.
spacecabbie
Mon, 11/26/2018 - 13:00
Permalink
Ok the file it self wil
Ok the file it self wil reflect all changes.
Its your H5P.timer that i cannot get to load i added in the liberary,json: (note: Its also added under Content -> H5P Liberary)
But i cannot call on it in the console and in network its not loaded.
I cannot see if the liberary.json file is actualy properly looked at since it does not show in network.
If you wish i can meet up in IRC to troubleshoot (or discord/skype something else)
otacke
Mon, 11/26/2018 - 14:13
Permalink
The library json file will
The library json file will not be loaded by the browser, but by the PHP based core of the H5P plugin, that's why you don't see it on the the network tab. I can only assume that Drupal 8 (without a dev mode) doesn't update the database table that holds the libraries that need to be loaded for a content type ("h5p_libraries_libraries"). You could either do that manually, or pack your source (wherever it is, doesn't have to be the H5P library folder in that case) using h5p_cli and upload the library file to drupal. However, without a dev mode, you'll have to increment the patch version of the library every time you do that, because libraries will not be replaced with the same version. Alternatively, you could add the missing row to the database table. It needs to contain the ID of the memory library, the ID of the timer library (both from the table h5p_libraries) and the depencency type "preloaded".
My suggestion is that you simply use Drupal 7 for development. That's our recommended system that's prepared for this job. You can upload your changes to your Drupal 8 system when you're done. Figuring out a way to mimic a proper development environment on Drupal 8 feels to be too tedious for me.
Also, please understand that we don't have the resources to offer "full 1:1 support" via IRC or other channels.
Best,
Oliver
spacecabbie
Mon, 11/26/2018 - 14:43
Permalink
check that explains allot !I
check that explains allot !
I shal install a drupal 7 dev env and work from there.
Oh the irc thing was just a suggestion i completly understand!
otacke
Mon, 11/26/2018 - 15:21
Permalink
Sorry! It's hard to say no
Sorry! It's hard to say no for me, especially when knowing that our documentation could elaborate way more on how H5P works :-/
spacecabbie
Mon, 11/26/2018 - 15:26
Permalink
I wish i could help :(
I wish i could help :(