deedey / moodle-block_annulab_lrs

This block for Moodle gives access to a user’s own historical data sent by the moodle's logstore_xapi and tincanlaunch plugins to the LRS of Annulab in a graphical format and data table. It requires a free subscription at https://lrsdata.com. The LRS enables anyone who is connected to import his/her own data in a JSON format file archived into a ZIP file.
1 stars 0 forks source link

get_content() function is called twice. #4

Closed danmarsden closed 6 years ago

danmarsden commented 6 years ago

When Moodle blocks are loaded on a page, the function get_content() is always called twice. For this reason blocks will store the result of get_content() in a var called $this->content and will check to see if $this->content contains any information before performing the work.

here's an example from an existing block: https://github.com/moodle/moodle/blob/master/blocks/completionstatus/block_completionstatus.php#L51

hopefully that makes sense. but let me know if you need further clarification.

deedey commented 6 years ago

I've added this test if ($this->content !== null) { return $this->content; }

danmarsden commented 6 years ago

looks good.