General developer forum

Moodle activity Error - Moodle 3.4

 
Picture of Dave Emsley
Moodle activity Error - Moodle 3.4
Particularly helpful Moodlers

Hi All,

I have "created" a new activity called dmurl.  It is basically the same as the URL module but rather than the entered URL goes to a very specific one with various parameters passed.

Anyway I get the error:

I cannot find any documentation to explain this error.  My module/lib.php has the same code as the URL module's but with dmurl inserted as appropriate.

Any thoughts and advice greatly recevied.

Cheers

Dave



 
Average of ratings: -
Davo
Re: Moodle activity Error - Moodle 3.4
Core developersParticularly helpful MoodlersPlugin developers

Did you forget to include the error?

Or was it really just a blank screen?

Either way, the best solution is often to find the line throwing the error (by turning debugging on to get the full error message, if possible), then use a combination of xdebug + suitable IDE (PHPStorm is my personal favourite for this), to put a breakpoint on the error line and then examine the state of the variables at that point and see what has gone wrong.


 
Average of ratings: -
Picture of Dave Emsley
Re: Moodle activity Error - Moodle 3.4
Particularly helpful Moodlers

LOL - Adding the error would have helped.

I've got debugging on. 


 
Average of ratings: -
Davo
Re: Moodle activity Error - Moodle 3.4
Core developersParticularly helpful MoodlersPlugin developers

OK - that one's easy to answer, as it's my code that's throwing the error.

Drag + drop upload can handle a number of different 'drop' types which are (off the top of my head):

  • file (you dragged and dropped a file onto a course page)
  • text (you dragged and dropped some selected text onto a course page)
  • url (you dragged and dropped a selected URL onto a course page - probably from a browser address bar)

Different plugins can declare that they handle one or more of these types (so, mod_url declares that it can handle 'urls' dropped onto a course page).

It is also possible to declare your own drop types in a plugin (just in case future browser developments introduce new types of things you can drag and drop into the browser).

In this case, you've declared that your plugin handles drops of type 'dmurl', which is not one of the 3 types that Moodle knows about. So you either need to declare that as a custom type, or (much more likely!) you just need to fix it to state that it handles 'url' drops.

 
Average of ratings:Useful (2)
Picture of Dave Emsley
Re: Moodle activity Error - Moodle 3.4
Particularly helpful Moodlers

Brilliant.  Thanks. 

Can I just ask should I just return null from both  dmurl_dndupload_register() and dmurl_dndupload_handle($uploadinfo)

Or just remove the two functions from mymodule/lib.php?

Cheers

Dave


 
Average of ratings: -
Davo
Re: Moodle activity Error - Moodle 3.4
Core developersParticularly helpful MoodlersPlugin developers

If you don't want to handle drag + drop upload onto a course, then just delete the functions.


 
Average of ratings: -