Block data not passed to view
If I want to load a block, without specifying a model, I can pass a data var to the fuel_block method:
echo fuel_block(array('view' => 'test_block', 'data' => array('test' => 'testing var')));
However this array is never passed on to the block your loading, if I'm correct...
If I call '$test' in test_block.php I get 'Undefined variable: test'
Possible fix:
In fuel/modules/fuel/helpers/fuel_helper line 96:
$data = $p['data'];
But $data is never used after that. I think to fix this line 96 should actually be:
$vars = $p['data'];
Because the view (=block) is loaded with the next method on lines 133 / 139:
$view = $CI->load->view("_blocks/".$p['view'], $vars, TRUE);
This way you can call $test in test_block.php.
However there's an extra option 'vars => array()' in the fuel_block() method, which isn't documented.
I'm not exactly sure what it's used for so to be safe, line 96 should be either:
$vars = array_merge($vars, $p['data']);
or:
$vars['data'] = $p['data'];
The latter requires you to call $data['test'] in test_block.php
Please correct me if I'm wrong of course!
Comments
$vars['data'] = $p['data'];
I think that's the best one too, using it right now and works pretty good.