Drupal:Displaying sub menus of primary link

23 10 2009

I want to display the sub menus of the currently accessing primary link as a block. Drupal provides Primary links, Secondary links blocks but does not display sub menus of currently accessing primary link.

When I search, I got following code snippet which lists the sub menus of currently accessing primary link. I directly created block using Add block by adding this php code snippet. It works a charm.

$tree = menu_tree_page_data('primary-links'); //substitute your menu name for primary-links
foreach($tree as $key => $mi) {
if ($mi['link']['in_active_trail'] && $tree[$key]['below']) {
$menu = menu_tree_output($tree[$key]['below']);
print $menu;

I hope this will help others to find easily.


Remove applied patch using patch command

23 10 2009

Today I am doing patch review of drupal7. I tested one patch, Now I want to remove this patch and go back to previous latest version of drupal. Unfortunately there is no cvs revert command which revert the files like in svn, bazaar, git etc..

I used same patch command to revert the applied patch.

I used following command to revert.

patch -p0 -R < patch_file_path.patch

In the above command -R option Assume patches were created with old and new files swapped. So it do the reverse operation of patch.