My apologize for my english.
I received this message in block section and I see the code say FIXME, so I want give a hand in this.
warning: preg_match() expects parameter 2 to be string, array given in D:\www\clientes2009\drupalargentina\v6\includes\bootstrap.inc on line 777.
/**
* Implementation of after_build callback
*/
function drupal_tweaks_block_tweak($form, $form_state) {
foreach ($form as $block_name => $block_data) {
if (is_array($block_data)) {
$module_name = $block_data['module']['#value'];
$form[$block_name]['info']['#suffix'] .= ' ' . sprintf(t('(module: %s)'), $module_name);
// FIXME: Why #suffix generates: warning: preg_match() expects parameter 2 to be string, array given in includes/bootstrap.inc on line 777 ?
}
}
return $form;
}
Y changed for this and it look like
/**
* Implementation of after_build callback
*/
function drupal_tweaks_block_tweak($form, $form_state) {
foreach ($form as $block_name => $block_data) {
if (is_array($block_data) && $block_data['module']['#value']) { //Not all the array is about modules blocks
$module_name = $block_data['module']['#value'];
$form[$block_name]['info']['#suffix'] .= ' ' . t('(module: %module)', array('%module' => $module_name)); //Minor change to t()
// FIXME: Why #suffix generates: warning: preg_match() expects parameter 2 to be string, array given in includes/bootstrap.inc on line 777 ?
}
}
return $form;
}
And it work like a charm
Comments
Comment #1
espirates commentedI get this one
warning: preg_match() expects parameter 2 to be string, array given in /drupal/includes/bootstrap.inc on line 1032.Your fix worked for me
Comment #2
kenorb commentedThank you, I'd no time to look after this.
Regarding t(), I don't wanted to use it, because it's adding unnecessary html code (some spans in some themes) and it's breaking the line.
Committed.
http://drupal.org/cvs?commit=314882
Comment #3
kenorb commentedComment #4
dariogcode commentedI don't sure but if you use !module in t() it don't add html code.
Comment #5
kenorb commentedThanks, I'll check that.
Comment #6
RaRi commentedAs I am not using the Drupal Tweak module, I assume the fix is nothing for me. Correct?
Comment #8
kenorb commentedRaRi: yes, usually following error:
warning: preg_match() expects parameter 2 to be string, array given in bootstrap.inc
is caused by some bug in contributed module.
You need to find other issue related to module that you using where this error appears.