Is it possible create a sub-plugin for a block?

Is it possible create a sub-plugin for a block?

by Juan Antonio Caballero Hernández -
Number of replies: 1

I'm currently writing a new block for Moodle 2.6 but this block also could be a part of another block written by me previously. I'd like to know if my new block could be a sub-plugin of the second block. I read in the sub-plugins documentation that you can create a sub-plugin for an activity module, but I don't know if sub-plugins for block exist.

Thanks in advance.

Average of ratings: Useful (1)
In reply to Juan Antonio Caballero Hernández

Re: Is it possible create a sub-plugin for a block?

by Valery Fremaux -
Picture of Plugin developers

I Juan

this is a long and old subject that still in transaction with HQ guys : 

At the moment, it is NOT possible to have a subplugin strategy in a block without some little hacks in core. 

You can see the VMoodle block (Moodle virtualisation) that explains it in README.txt. 

What fails : 

- Sub plugin discovery needs a little push to accept seeking in a block

- String management ignores subplugin strategy in blocks. This will drive you to implement your own blockname_get_string($key, $subpluginname) function and route to your subplugin lang files.

This also is demonstrated in blocks/vmoodle/locallib.php

searching for vmoodle_get_string() function. 

Appart of those two points, other parts of moodle related to subplugins (events f.e.) work fine...

https://tracker.moodle.org/browse/MDL-20378 (Closed, first try 2010)

https://tracker.moodle.org/browse/MDL-37944 (2013 Deffered, should get votes for raising up)

Cheers !

Average of ratings: Useful (1)