Commit 25cbcb46 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1829940: Make placeholder blocktype be active by default

And stop it from being deactivated


Change-Id: I26adfb9cff0ffa6f189b44b634ae04f6641a9ced
Signed-off-by: Robert Lyon's avatarRobert Lyon <>
parent 62e432fb
......@@ -15,7 +15,7 @@ define('JSON', 1);
define('NOSESSKEY', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require_once(get_config('docroot') . 'blocktype/lib.php');
// Close the session to prevent session locking.
......@@ -16,3 +16,4 @@ $string['description'] = 'Placeholder block that allows you to select what type
$string['placeholdertext'] = 'Please configure the block to choose what type of block this should be';
$string['defaulttitledescription'] = 'A default title will be generated if you leave the title field blank';
$string['contenttypes'] = 'Content types';
$string['placeholderblocktypenotenabled'] = 'The block type "placeholder" needs to be installed and be active. If it is already installed please set it to be active via the database "blocktype_installed" table.';
......@@ -25,6 +25,18 @@ class PluginBlocktypePlaceholder extends MaharaCoreBlocktype {
return array('shortcut' => 500);
public static function is_active() {
return get_field('blocktype_installed', 'active', 'name', 'placeholder');
* We want this blocktype to be the default blocktype so we
* will prevent it being disabled.
public static function can_be_disabled() {
return false;
public static function render_instance(BlockInstance $instance, $editing=false, $versioning=false) {
global $USER, $THEME;
$configdata = $instance->get('configdata');
......@@ -495,6 +495,14 @@ if (!defined('INSTALLER')) {
throw new ConfigSanityException(get_string('multirecipientnotificationnotenabled',
if (!$siteclosedforupgrade) {
// Make sure that placeholder block is installed and active
safe_require('blocktype', 'placeholder');
if (!PluginBlocktypePlaceholder::is_active()) {
throw new ConfigSanityException(get_string('placeholderblocktypenotenabled',
......@@ -32,7 +32,6 @@ Scenario:
And I click on "Show more"
And I click on "Navigation" in the "Content types" property
And I select "Collection UserA_02" from "Collection"
And I click on "Set a block title"
And I set the field "Block title" to "Nav for collection B"
And I enable the switch "Add to all pages"
And I select "Automatically retract" from "Retractable"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment