本文整理汇总了PHP中Walker_Nav_Menu::start_el方法的典型用法代码示例。如果您正苦于以下问题:PHP Walker_Nav_Menu::start_el方法的具体用法?PHP Walker_Nav_Menu::start_el怎么用?PHP Walker_Nav_Menu::start_el使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Walker_Nav_Menu
的用法示例。
在下文中一共展示了Walker_Nav_Menu::start_el方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start_el
public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
if ($this->has_children) {
$before = '<input type="checkbox" id="cb_' . $item->ID . '">' . '<label class="sub-menu-toggle" for="cb_' . $item->ID . '"><span class="fa fa-chevron-down"></span></label>';
}
$output .= $before . parent::start_el($output, $item, $depth, $args, $id);
}
示例2: array
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
$item_html = '';
parent::start_el($item_html, $item, $depth, $args);
$classes = empty($item->classes) ? array() : (array) $item->classes;
$output .= $item_html;
}
示例3: array
function start_el(&$output, $item, $depth = 2, $args = array(), $id = 0)
{
$item_html = '';
parent::start_el($item_html, $item, $depth, $args);
$item_html = apply_filters('stachestack_wp_nav_menu_item', $item_html);
$output .= $item_html;
}
示例4: array
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
parent::start_el($output, $item, $depth, $args);
if (!empty($item->description)) {
$output .= sprintf('<i>%s</i>', esc_html($item->description));
}
}
示例5: array
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
if (0 == $depth) {
return;
}
parent::start_el($output, $item, $depth, $args);
}
示例6: array
/**
* @see Walker_Nav_Menu::start_el()
* @since 1.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $object
* @param int $depth Depth of menu item. Used for padding.
* @param array|object $args
* @param int $current_object_id
* @internal param object $item Menu item data object.
*/
function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
{
$item_html = '';
parent::start_el($item_html, $object, $depth, $args);
$classes = empty($object->classes) ? array() : (array) $object->classes;
// FB::info($item_html, '$item_html');
/* $output .= ($depth == 0) ? '<li class="divider"></li>' : '';
$classes[] = 'menu-item-' . $object->ID;
$classes[] = ($depth == 0) ? 'title' : '';
$classes[] = (in_array('current-menu-item', $classes) && !in_array('active', $classes)) ? 'active' : '';
$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $object, $args));
$class_names = $class_names ? 'class="' . esc_attr($class_names) . '"' : '';*/
//FB::info($object,'$object');
if (in_array('label', $classes)) {
$item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '<label>$1</label>', $item_html);
}
if (in_array('divider', $classes)) {
$item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '', $item_html);
}
// $indent = ($depth) ? str_repeat("\t", $depth) : '';
// $output .= $indent . '<li id="menu-item-' . $object->ID . ' " ng-class="$location.path()
// " ' . $class_names . '>';
$output .= $item_html;
// parent::start_el($output, $object, $depth, $args);
// FB::info($output, ' $output');
}
示例7: array
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
$item_html = '';
parent::start_el( $item_html, $item, $depth, $args);
if ( $item->is_dropdown ) {
//makes top menu not clickable (default bootstrap behaviour)
$search = '<a';
$replace = ( ! wp_is_mobile() && 'hover' == esc_attr( TC_utils::$inst->tc_opt( 'tc_menu_type' ) ) ) ? $search : '<a class="dropdown-toggle" data-toggle="dropdown" data-target="#"';
$replace .= strpos($item_html, 'href=') ? '' : ' href="#"' ;
$replace = apply_filters( 'tc_menu_open_on_click', $replace , $search );
$item_html = str_replace( $search , $replace , $item_html);
//adds arrows down
if ( $depth === 0 )
$item_html = str_replace( '</a>' , ' <b class="caret"></b></a>' , $item_html);
}
elseif (stristr( $item_html, 'li class="divider' )) {
$item_html = preg_replace( '/<a[^>]*>.*?<\/a>/iU' , '' , $item_html);
}
elseif (stristr( $item_html, 'li class="nav-header' )) {
$item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU' , '$1' , $item_html);
}
$output .= $item_html;
}
示例8: array
function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
{
$item_html = '';
parent::start_el($item_html, $object, $depth, $args);
$output .= $depth == 0 ? '' : '';
$classes = empty($object->classes) ? array() : (array) $object->classes;
// Fix dropdown menús con children - chevron
$dropdownSections = ["nosotros", "about us"];
foreach ($dropdownSections as $section) {
if (in_array(str_replace(' ', '-', $section), $classes)) {
$output .= '';
$url = get_permalink(get_page_by_title($section)->ID);
$replacement = "<i class=\"fa fa-chevron-down\"></i><a href=\"" . esc_url($url) . "\">" . ucfirst($section) . "</a>";
$item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', $replacement, $item_html);
}
}
//
if (in_array('label', $classes)) {
$output .= '';
$item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '<label>$1</label>', $item_html);
}
if (in_array('divider', $classes)) {
$item_html = preg_replace('/<a[^>]*>( .* )<\\/a>/iU', '', $item_html);
}
$output .= $item_html;
}
示例9:
function start_el(&$output, $item, $depth, $args)
{
$item->title = str_repeat("-", $depth) . " " . $item->title;
parent::start_el($output, $item, $depth, $args);
$output = str_replace('<li', '<option value="' . $item->url . '"' . (in_array("current-menu-item", (array) $item->classes) ? ' selected="selected"' : ''), $output);
$output = strip_tags($output, '<select>,<option>');
}
示例10:
function start_el(&$output, $item, $depth, $args)
{
global $framework;
$selected = $framework->get_current_url() == $item->url ? 'selected="selected"' : '';
$item->title = str_repeat(" ", $depth * 4) . $item->title;
parent::start_el($output, $item, $depth, $args);
$output = str_replace('<li', '<option ' . $selected . ' value="' . $item->url . '"', $output);
}
示例11: array
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
$item_html = '';
parent::start_el($item_html, $item, $depth, $args);
if ($item->is_dropdown) {
$item_html = str_replace('</a>', '</a> <button class="sub-menu-unfold" aria-expanded="false"><span>' . __("Unfold Sub-Menu", "from-scratch") . '</span></button>', $item_html);
}
$output .= $item_html;
}
示例12: start_el
public function start_el(&$output, $item, $depth, $args)
{
// add spacing to the title based on the current depth
$item->title = esc_attr($item->title);
// call the prototype and replace the <li> tag
// from the generated markup...
parent::start_el(&$output, $item, $depth, $args);
$output .= ' <option value="' . $item->url . '">' . $item->title;
}
示例13: array
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
$item_html = '';
parent::start_el($item_html, $item, $depth, $args);
if ($item->is_dropdown && $depth === 0) {
$item_html = str_replace('<a', '<a ' . display_control(), $item_html);
$item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html);
}
$output .= $item_html;
}
示例14: empty
function start_el(&$output, $item, $depth, $args)
{
$item_html = '';
parent::start_el($item_html, $item, $depth, $args);
$classes = empty($item->classes) ? array() : (array) $item->classes;
if (in_array('section', $classes)) {
$item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '<label>$1</label>', $item_html);
}
$output .= $item_html;
}
示例15: array
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
$item_html = '';
parent::start_el($item_html, $item, $depth, $args);
if ($item->is_dropdown && $depth === 0) {
$item_html = str_replace('<a', '<a class="dropdown-toggle"', $item_html);
}
$item_html = apply_filters('erh_wp_nav_menu_item', $item_html);
$output .= $item_html;
}