Commit adf71134 authored by Dries's avatar Dries

- Patch #470210 by Johan Morahan: nice clean-up of block configuration that...

- Patch #470210 by Johan Morahan: nice clean-up of block configuration that fixes input format issue.
parent c9e4bbf9
......@@ -202,9 +202,7 @@ function block_block_configure($delta = 0, $edit = array()) {
if ($delta) {
$box = block_box_get($delta);
}
if (filter_access($box['format'])) {
return block_box_form($box);
}
return block_box_form($box);
}
/**
......@@ -388,16 +386,13 @@ function block_box_form($edit = array()) {
'#description' => t('The content of the block as shown to the user.'),
'#required' => TRUE,
'#weight' => -17,
'#access' => filter_access($edit['format']),
);
return $form;
}
function block_box_save($edit, $delta) {
if (!filter_access($edit['body_format'])) {
$edit['body_format'] = FILTER_FORMAT_DEFAULT;
}
db_query("UPDATE {box} SET body = '%s', info = '%s', format = %d WHERE bid = %d", $edit['body'], $edit['info'], $edit['body_format'], $delta);
return TRUE;
......
......@@ -85,6 +85,18 @@ class BlockTestCase extends DrupalWebTestCase {
// Confirm that the box is being displayed using configured text format.
$this->assertRaw('<h1>Full HTML</h1>', t('Box successfully being displayed using Full HTML.'));
// Confirm that a user without access to Full HTML can not see the body field,
// but can still submit the form without errors.
$block_admin = $this->drupalCreateUser(array('administer blocks'));
$this->drupalLogin($block_admin);
$this->drupalGet('admin/build/block/configure/block/' . $bid);
$this->assertNoText(t('Block body'));
$this->drupalPost('admin/build/block/configure/block/' . $bid, array(), t('Save block'));
$this->assertNoText(t('Please ensure that each block description is unique.'));
// Confirm that the box is still being displayed using configured text format.
$this->assertRaw('<h1>Full HTML</h1>', t('Box successfully being displayed using Full HTML.'));
}
/**
......
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