Skip to content

Instantly share code, notes, and snippets.

@gh640
Last active August 14, 2022 02:34
Show Gist options
  • Select an option

  • Save gh640/cfbc1ad09a8d7a85d6b7 to your computer and use it in GitHub Desktop.

Select an option

Save gh640/cfbc1ad09a8d7a85d6b7 to your computer and use it in GitHub Desktop.
Drupal 7 で現在のページのメニュー上の親のページのパスを取得する
<?php
// 現在のページが `user/1/cards/create` なら
// $parent_menu_item_path は `user/1/cards` になる
$current_menu_item = menu_get_item();
$parent_menu_item_path = $current_menu_item['tab_parent_href'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment