BP_Walker_Nav_Menu_Checklist

Create a set of BuddyPress-specific links for use in the Menus admin UI.

Defined (1)

The class is defined in the following location(s).

/bp-core/classes/class-bp-walker-nav-menu-checklist.php  
  1. class BP_Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { 
  2.  
  3. /** 
  4. * Constructor. 
  5. * @see Walker_Nav_Menu::__construct() for a description of parameters. 
  6. * @param array|bool $fields See {@link Walker_Nav_Menu::__construct()}. 
  7. */ 
  8. public function __construct( $fields = false ) { 
  9. if ( $fields ) { 
  10. $this->db_fields = $fields; 
  11.  
  12. /** 
  13. * Create the markup to start a tree level. 
  14. * @see Walker_Nav_Menu::start_lvl() for description of parameters. 
  15. * @param string $output See {@Walker_Nav_Menu::start_lvl()}. 
  16. * @param int $depth See {@Walker_Nav_Menu::start_lvl()}. 
  17. * @param array $args See {@Walker_Nav_Menu::start_lvl()}. 
  18. */ 
  19. public function start_lvl( &$output, $depth = 0, $args = array() ) { 
  20. $indent = str_repeat( "\t", $depth ); 
  21. $output .= "\n$indent<ul class='children'>\n"; 
  22.  
  23. /** 
  24. * Create the markup to end a tree level. 
  25. * @see Walker_Nav_Menu::end_lvl() for description of parameters. 
  26. * @param string $output See {@Walker_Nav_Menu::end_lvl()}. 
  27. * @param int $depth See {@Walker_Nav_Menu::end_lvl()}. 
  28. * @param array $args See {@Walker_Nav_Menu::end_lvl()}. 
  29. */ 
  30. public function end_lvl( &$output, $depth = 0, $args = array() ) { 
  31. $indent = str_repeat( "\t", $depth ); 
  32. $output .= "\n$indent</ul>"; 
  33.  
  34. /** 
  35. * Create the markup to start an element. 
  36. * @see Walker::start_el() for description of parameters. 
  37. * @param string $output Passed by reference. Used to append additional 
  38. * content. 
  39. * @param object $item Menu item data object. 
  40. * @param int $depth Depth of menu item. Used for padding. 
  41. * @param object|array $args See {@Walker::start_el()}. 
  42. * @param int $id See {@Walker::start_el()}. 
  43. */ 
  44. function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { 
  45. global $_nav_menu_placeholder; 
  46.  
  47. $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; 
  48. $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; 
  49. $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; 
  50.  
  51. $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; 
  52.  
  53. $output .= $indent . '<li>'; 
  54. $output .= '<label class="menu-item-title">'; 
  55. $output .= '<input type="checkbox" class="menu-item-checkbox'; 
  56.  
  57. if ( property_exists( $item, 'label' ) ) { 
  58. $title = $item->label; 
  59.  
  60. $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> '; 
  61. $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title ); 
  62. $output .= '</label>'; 
  63.  
  64. if ( empty( $item->url ) ) { 
  65. $item->url = $item->guid; 
  66.  
  67. if ( ! in_array( array( 'bp-menu', 'bp-'. $item->post_excerpt .'-nav' ), $item->classes ) ) { 
  68. $item->classes[] = 'bp-menu'; 
  69. $item->classes[] = 'bp-'. $item->post_excerpt .'-nav'; 
  70.  
  71. // Menu item hidden fields. 
  72. $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />'; 
  73. $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />'; 
  74. $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />'; 
  75. $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="custom" />'; 
  76. $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />'; 
  77. $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />'; 
  78. $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />'; 
  79. $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />'; 
  80. $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />'; 
  81. $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';