Installed block not showing in 'Add block'

Installed block not showing in 'Add block'

by Fred Riley -
Number of replies: 2

Here's a general question with a very specific context, related to a custom-developed block. First the question:

Why might a correctly-installed block not appear in the Add a Block dropdown in edit mode? 

Now the context:

I've created a block - call it Hamster Herding - for local use. I've developed and tested it on localhost using Moodle 2.6 and XAMPP, then deployed it on a live test system. It used to work fine on local and remote hosts. We then decided that it needed to be renamed. I went through all the renaming procedures (files, variables, caches, etc), then put the block in moodle/blocks/hamster_herding and installed it via Admin >> Notifications. The block appeared to install ok, and when I then went into Site Admin >> Plugins >> Blocks >> Manage Blocks I could see it listed there. However, it didn't appear in the Add a Block dropdown so of course I couldn't add it to a course. Neither do any error messages appear.

Amongst many other measures, I've:

  • de- and re-installed the block
  • flushed Moodle caches
  • flushed browser caches from the beginning of time
  • set developer errors to super-picky
  • installed the block on another machine altogether
  • changed the block version number
  • read TFM and TFFAQ

I think it's almost certainly related to the use of caches in the block, which are needed because of the institutional context in which it'll be deployed. I have just used basic cacheing code as specified in the Cache API, and when renaming the block made sure to rename the block caches. 

I'm sure that it'll be one tiny tweak somewhere that's needed, but I just can't find the cause of the problem as I'm getting no feedback from Moodle at all, so a pointer or two would be appreciated.

Still fumbling in the undergrowth...

Fred

Average of ratings: -
In reply to Fred Riley

Re: Installed block not showing in 'Add block'

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Have you tried fiddling with the applicable_formats settings?

The big fiddle would be to set all to true. Don't do it in production though. Like this.

    public function applicable_formats() {

         return array('all' => true);

    }

Average of ratings: Useful (2)
In reply to Fred Riley

Re: Installed block not showing in 'Add block'

by Nathan Mcilree -

Not sure if this helps but MOODLE was not recognising one of my blocks which had a camel case naming conventaion.  I swapped it to unserscores and all lower case and it then recognised it.

Average of ratings: Useful (2)