When I attempt to add a block reference field to node, I get hit with this notice:
# Notice: Undefined index: referenceable_modules in _blockreference_potential_references_standard() (line 434 of C:\WWW\smarsh\sites\all\modules\blockreference\blockreference.module).
# Notice: Undefined index: info in _blockreference_potential_references_standard() (line 471 of C:\WWW\smarsh\sites\all\modules\blockreference\blockreference.module).
This is in Drupal 7.. What I did was install the module, create some blocks, and then attempt to assign the field to a node.
After looking at it, probably just adding some "if !empty()" lines will fix..
I modified line 471 to be:
if(!empty($block_info[$block->delta]['info'])) {
$block->info = $block_info[$block->delta]['info'];
} else {
$block->info = '';
}
And line 434 to be:
if (!empty($field['referenceable_modules']) && is_array($field['referenceable_modules'])) {
Seems to have fixed. I have my PHP error reporting set to strict, that might have been a part of it.
This is a great idea for a module by the way - I was using node reference and thought "what I really need is a block reference", and what do you know - here it is!
Comments
Comment #1
wheelercreek commentedSorry - the change to line 471 didn't quite work. I'm getting empty strings in my block drop down on the node edit.
I had to change it to be this:
After looking at the var_dump on the block_info, this was what I came up with. It's working for me..
Any idea why that would be the case?
Comment #2
danielb commentedI'll get those notices fixed up soon.
As for the double [$block->delta], I think the problem is with this:
The result from module_invoke already has the [$block->delta] part.
It needs to be more like
And then the rest of the code should be looking in $block_info[$block->module][$block->info]['info']
There's even one spot where the old variable $info is used by mistake :/
This might affect Drupal 6 too.
Comment #3
danielb commentedI've made a new release with that change.
Comment #4
wheelercreek commentedThanks daniel, I just updated - but now getting a line 106 notice?:
Notice: Undefined index: referenceable_modules in blockreference_field_settings_form() (line 106 of C:\WWW\smarsh\sites\all\modules\blockreference\blockreference.module).
Comment #5
wheelercreek commentedI modifed to that form element at line 106 to be this:
and works now.
Comment #6
danielb commentedI knew that would come back to bite me
Comment #7
danielb commentedCheers, I've done it a bit differently.