\n";
}
/**
* Starts the element output.
*
* @param string $output Used to append additional content (passed by reference).
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param int $id Current item ID.
*/
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$li_attributes = '';
$class_names = $value = ''; // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.Found
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = ( $args->walker->has_children ) ? 'dropdown' : '';
$classes[] = ( $item->current || $item->current_item_ancestor ) ? 'active' : '';
$classes[] = 'menu-item-' . $item->ID;
$classes[] = 'nav-item';
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
// phpcs:enable
$class_names = ' class="' . esc_attr( $class_names ) . '"';
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args );
// phpcs:enable
$id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '
';
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) . '"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) . '"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) . '"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) . '"' : '';
$attributes .= ( $args->walker->has_children ) ? ' class="nav-link dropdown-item dropdown-toggle" data-hover="dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"' : ' class="nav-link"';
$item_output = $args->before;
$item_output .= ( $depth > 0 ) ? ' ' : '';
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
// phpcs:enable
$item_output .= ( $args->walker->has_children ) ? '' : '';
$item_output .= $args->after;
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
// phpcs:enable
}
/**
* Fall back if no menu is selected
*
* @param array $args An array of wp_nav_menu() arguments.
*/
public static function fallback( $args ) {
// phpcs:disable WordPress.PHP.DontExtract.extract_extract
extract( $args );
// phpcs:enable
$before = '';
wp_page_menu(
array(
'show_home' => true,
'container' => $container,
'before' => $before,
'after' => $after,
'echo' => true,
)
);
}
}
}
endif;