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

merge-requests/26/head
Dries Buytaert 2009-05-24 07:13:12 +00:00
parent c9e4bbf91d
commit adf7113451
2 changed files with 14 additions and 7 deletions

View File

@ -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;

View File

@ -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.'));
}
/**