Installation Plugin

Installation Plugin

by Valentine Cotter -
Number of replies: 2

Hello everyone,

I'm developing my first "block" moodle plugin by following the tutorial below :

https://docs.moodle.org/dev/Blocks

Unfortunately, I'm stuck at the "I Just Hear Static" part.

So I've done the tutorial correctly so far, but when I try to add my plugin on moodle (by zip file), everything works until the moodle database upgrade time. I then receive an error concerning my master file, which I put in copy below :


<?php

class block_timer extends block_base 

{

//Gives a value for all variables that are instantiated in the class

    public function init() 

    {

        $this->title = get_string('timer', 'block_timer'); //Title displayed in the block header

    }


    public ​function get_content() {

   ​if ($this->content !== null) {

     ​return $this->content;

   ​}

 

   ​$this->content         =  new stdClass;

   ​$this->content->text   = 'The content of our SimpleHTML block!';

   ​$this->content->footer = 'Footer here...';

 

   ​return $this->content;

    }

  }

The error message and my file folder is attached.

Help meee pleaseeee smile
Attachment Sans titre 1.jpg
Average of ratings: -
In reply to Valentine Cotter

Re: Installation Plugin

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Line 14 is the error:

-​$this->content = new stdClass;
​+$this->content = new stdClass();
In reply to Renaat Debleu

Re: Installation Plugin

by Valentine Cotter -

Hello,

Thank you for your answer.

I try to modified the line 14, but the problem is still the same...