1

I have a view that display some nodes and some of this nodes have a menu voice connected to them with sub menus.

main menu:
-node 1 [mid:407]
--node 2
--node 3
-node 4 [mid:219]
--node 5

I want my views display something like:

node 1 data + the submenu
--node 2
--node 3

node 4 data + the submenu
--node 5

I installed the module menu_block and I created a block that display all the child of a menu voice and I tryed to change the 'parent' setting it programmatically and display the block like this:

$block = block_load('menu_block', 1);
$render_array = _block_get_renderable_array(_block_render_blocks(array($block)));
print_r($render_array['menu_block_1']['#config']);

$render_array['menu_block_1']['#config']['parent'] = 'main-menu:219';
$render_array['menu_block_1']['#config']['parent_mlid'] = 219;
print_r($render_array['menu_block_1']['#config']);

$output = drupal_render($render_array);
print $output;

the 2 output of the print_r are

Array
(
    [parent] => main-menu:407
    [title_link] => 0
    [admin_title] => 
    [level] => 1
    [follow] => 0
    [depth] => 0
    [depth_relative] => 0
    [expanded] => 0
    [sort] => 0
    [parent_mlid] => 407
    [menu_name] => main-menu
    [delta] => 1
)
Array
(
    [parent] => main-menu:219
    [title_link] => 0
    [admin_title] => 
    [level] => 1
    [follow] => 0
    [depth] => 0
    [depth_relative] => 0
    [expanded] => 0
    [sort] => 0
    [parent_mlid] => 219
    [menu_name] => main-menu
    [delta] => 1
)

but when I render the block he still display the sons of the 'main-menu:407' menu items
--node 2
--node 3

How can I really change the config programmatically?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.