Modifying Drag-the-words

Hello,

I'm relatively new to H5P but have been working extensively with it as of late.

I'm working on a project to allow the input of a large text for the drag and drop content type, simliar to memory game content type, and only a certain number of the lines to be selected each time the quiz is taken.

I'm working with the wordpress plugin of h5p. I have made some of the necessary changes to the javaScript but they only seem to work if I modify the files in cached assets. This feels wrong.

Also, I want to add a numLines parameter to the editor for when you create a drag and drop quiz. I added the numLines parameter in the semantics.json file but it is not appearing when i go to make a new quiz.

Any ideas?

Thanks.

Content types: 
papi Jo's picture

Hi Joseph!

Welcome to our H5P forum. Your post is not very clear, but I'll try to answer it.

  • Your post is not related to the Content creation forum but to the Developers forum (could an moderator move it there please?)
  • It looks like you are creating a hack of an H5P content; in this case you should really use a relevant H5P development environment, as explained here: https://h5p.org/development-environment
  • If you don't use a development environment, you will never achieve what you want, both with the javascript and the semantics file!
  • Are you actually talking about the Drag and Drop H5P content or the Drag text H5P content? You use alternatively both names in your post, but they are 2 different and un-related contents!
  • You write "I'm working on a project to allow the input of a large text for the drag and drop content type, simliar to memory game content type, and only a certain number of the lines to be selected each time the quiz is taken." This is not clear. Please provide more information, maybe screen mock-ups, etc. to help understand what you are really trying to do.
  • Looking forward to your reply!

Thanks for the response.

  • For the development enviroment, would you recommend Drupal 7, which is soon to be discontinued, Drupal 10,  if H5P works on it, or another enviroment?
  • Sorry for the confusion, currently only the drag text content type though I'm working on a similar modification for the Mark the words content type as well.
  • Elaboration: In "drag text" what I'm doing it making it so that when you put in the text for the quiz (with stars around the blanks) you can put in a large number of lines. Each time a user opens the quiz, they will get a different combination of a smaller number of those lines randomly selected from the larger block of lines inputed. This is similar to how the memory content type works using the numCardsToUse parameter in behavior settings.
  • Another question, if I would like to add another parameter to the behaviour settings for the drag text editor what files should I work in? (I have already added the new parameter in semantics.json but I can't get this parameter to show up in the editor yet)
papi Jo's picture

  • For the dev environment you are correct, Drupal 7 is being phased out. Instead I recommend using the H5P CLI enfironment to be found at https://github.com/h5p/h5p-cli. It's still under development and a bit clunky but I am using it (on a Windows 11 machine). You have to have some notions of npm, nodeJs and git.
  • OK, you mean drag text then.
  • "Elaboration". Sorry, I still cannot visualize what you want to achieve. By "lines", do you mean chunk of words or actual lines, separated by line breaks (or paragraphs)? Again, the best way to make your point would be to provide real-life examples (in English), in text or/and mock-up screenshots.
  • If you do not work with a proper development environment, if you make changes to the semantics file, this is no use, because the contents of semantics is saved in the database at install, and cannot be altered. One workaround if you insist is to make the changes directly in the database, at your own risk.
  • You might be interested in my 'papi Jo' hacks, including the Drag Text content, available on my Moodle test site at https://www.rezeau.org/moodle/course/section.php?id=77
  • Finally, please note that when you create a post on this H5P forum, your post "disappears" while waiting for moderation. This weird behaviour regularly leads forum members to re-post (and re-re-post) their message, which you did. Just a minor annoyance...

H5P CLI worked great

What is the best way to transform my modified version of a standard content type into a new content type?

Thanks for the response.

  • For the development enviroment, would you recommend Drupal 7, which is soon to be discontinued, Drupal 10,  if H5P works on it, or another enviroment?
  • Sorry for the confusion, currently only the drag text content type though I'm working on a similar modification for the Mark the words content type as well.
  • Elaboration: In "drag text" what I'm doing it making it so that when you put in the text for the quiz (with stars around the blanks) you can put in a large number of lines. Each time a user opens the quiz, they will get a different combination of a smaller number of those lines randomly selected from the larger block of lines inputed. This is similar to how the memory content type works using the numCardsToUse parameter in behavior settings.
  • Another question, if I would like to add another parameter to the behaviour settings for the drag text editor what files should I work in? (I have already added the new parameter in semantics.json but I can't get this parameter to show up in the editor yet)

Thanks for the response.

  • For the development enviroment, would you recommend Drupal 7, which is soon to be discontinued, Drupal 10,  if H5P works on it, or another enviroment?
  • Sorry for the confusion, currently only the drag text content type though I'm working on a similar modification for the Mark the words content type as well.
  • Elaboration: In "drag text" what I'm doing it making it so that when you put in the text for the quiz (with stars around the blanks) you can put in a large number of lines. Each time a user opens the quiz, they will get a different combination of a smaller number of those lines randomly selected from the larger block of lines inputed. This is similar to how the memory content type works using the numCardsToUse parameter in behavior settings.
  • Another question, if I would like to add another parameter to the behaviour settings for the drag text editor what files should I work in? (I have already added the new parameter in semantics.json but I can't get this parameter to show up in the editor yet)