summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/block/block.module9
-rw-r--r--modules/block/block.test12
2 files changed, 14 insertions, 7 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index bcbf77360..c52cf5143 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -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;
diff --git a/modules/block/block.test b/modules/block/block.test
index 2c456739c..b6b1dd54b 100644
--- a/modules/block/block.test
+++ b/modules/block/block.test
@@ -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.'));
}
/**