General developer forum

Is it possible to add custom options to block edit control drop-down options?

 
Picture of Joe Cape
Is it possible to add custom options to block edit control drop-down options?
 

I want to add some extra admin options to my block. 

I could add a button to the block content but it would be nice to be able to add as an extra option to the drop-down. 

I am looking through the edit_controls method (lib/blocklib.php) and get_content_for_output method (blocks/moodleblock.class.php) and I can't see any obvious way that these support adding custom options.

Is this possible?

Thanks.

 
Average of ratings: -
Picture of Mark Johnson
Re: Is it possible to add custom options to block edit control drop-down options?
Core developersParticularly helpful MoodlersPlugin developers

Hi Joseph,

Would you like to add a plugin setting that applies globally to the block, or an instance config setting that applies to a single instance?

The former are defined in /block/blockname/settings.php, the latter in block/blockname/edit_form.php.

block_html has examples of both.

 
Average of ratings: -
Picture of Joe Cape
Re: Is it possible to add custom options to block edit control drop-down options?
 

Hi Mark,

The link will be to a custom admin page, which changes settings in relation to the course. So it is for a single instance, rather than site-wide. 

I could put it in edit_form.php, but that would mean users would first have to go to the Configure... option and then click through. 

I wanted to know whether it is possible to add another option to the drop-down, in addition to Configure..., Permissions, etc, with its own icon that could link to my custom admin page. Do you know if this is supported? Thanks.

 
Average of ratings: -