Solving illegal string offset 'region' and 'status' when saving block admin
This commit is contained in:
parent
42540d1310
commit
8bc400de2a
1 changed files with 7 additions and 3 deletions
|
@ -98,10 +98,14 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
|
|||
*/
|
||||
function block_admin_display_form_submit($form, &$form_state) {
|
||||
foreach ($form_state['values'] as $block) {
|
||||
// Avoid illegal string offset when saving block admin:
|
||||
// https://www.drupal.org/node/1680614#comment-7181392
|
||||
if (is_array($block)) {
|
||||
$block['status'] = $block['region'] != BLOCK_REGION_NONE;
|
||||
$block['region'] = $block['status'] ? $block['region'] : '';
|
||||
db_query("UPDATE {blocks} SET status = %d, weight = %d, region = '%s', throttle = %d WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $block['status'], $block['weight'], $block['region'], isset($block['throttle']) ? $block['throttle'] : 0, $block['module'], $block['delta'], $block['theme']);
|
||||
}
|
||||
}
|
||||
drupal_set_message(t('The block settings have been updated.'));
|
||||
cache_clear_all();
|
||||
}
|
||||
|
|
Reference in a new issue