Semantics
Submitted by alkanadi on Mon, 08/08/2016 - 18:28
Forums:
Warning: This is probably a retarded question. Leave now if you can't handle noobs.
I downloaded the single choice set. I am now looking at the code. This code is from the H5P.SingleChoiceSet-1.4/semantics.json
"fields": [
{
"name": "question",
"type": "text",
"widget": "html",
"tags": ["p", "br", "strong", "em"],
"label": "Question"
},
If I change the type from "text" to "image", and get rid of widget and tags, is that the only thing that I have to do to add images instead of text? It can't be this simple right?
fnoks
Tue, 08/09/2016 - 11:37
Permalink
There is no such thing as a
There is no such thing as a retarded question - only retarded answers ;)
In your example, if you change type from text to image, the editor will create an image widget, so you can upload an image. The problem is that the JavaScript code assumes text is what is coming in, and will therefore not handle this very well. Conclusion: in your case, the JavaScript code also needs to be changed.
alkanadi
Tue, 08/09/2016 - 16:44
Permalink
Thanks. I appreciate it. Okay
Thanks. I appreciate it. Okay, so I changed the code to the following:
{
"name": "question",
"type": "image",
"label": "Question"
},
What file do I change next so that the JavaScript code assumes that an image is coming?
fnoks
Wed, 08/10/2016 - 09:54
Permalink
Hi,You could look at how this
Hi,
You could look at how this is done in the JavaScript-files in other content types displaying images. I see you have been looking at the Greeting card tutorial - that's a good start :)
alkanadi
Thu, 08/11/2016 - 15:55
Permalink
I checked the other content
I checked the other content types but it is very overwhelming. I think I need to see a barebones basic library that handles each file type.
fnoks
Fri, 08/12/2016 - 10:27
Permalink
Have you looked at H5P
Have you looked at H5P.GreetingCard? It contains one textfield and one image in semantics.json.
alkanadi
Sun, 08/14/2016 - 10:25
Permalink
Yes. I checked it out
Yes. I checked it out