General developer forum

Block configuration in externallib.php

 
Picture of Quentin Fombaron
Re: Block configuration in externallib.php
Plugin developers

I finally found a solution :

$coursecontext = context_course::instance($courseid);
$blockrecord = $DB->get_record('block_instances', array('blockname' => 'your_block_name',
'parentcontextid' => $coursecontext->id), '*', MUST_EXIST);
$blockinstance = block_instance('your_block_name', $blockrecord);
$blockinstance->config->your_config_key
cool

 
Average of ratings: Useful (1)