library/Theme/Navigation.php
public function addTranslate($items, $args = null)
    {
        if (!is_object($args)) {
            $args = (object)$args;
        }
        
        if ($args && $args->theme_location != get_field('google_translate_menu', 'option')) {
            return $items;
        }

        //Not in child (if inherited from main)
        if ($args && (isset($args->child_menu) && $args->child_menu == true) && $args->theme_location == "main-menu") {
            return $items;
        }

        $label = 'Translate';
        if (get_field('google_translate_show_as', 'option') == 'icon') {
            $label = '<span data-tooltip="Translate"><i class="pricon pricon-globe"></i></span>';
        } elseif (get_field('google_translate_show_as', 'option') == 'combined') {
            $label = '<i class="pricon pricon-globe"></i> Translate';
        }

        $translate = '<li class="menu-item-translate"><a href="#translate" class="translate-icon-btn" aria-label="translate">' . $label . '</a></li>';

        if (isset($args->include_top_level)) {
            $items = $translate . $items;
        } else {
            $items .= $translate;
        }

        return $items;
    }
public function addTranslate($items, $args = null)
    {
        if (!is_object($args)) {
            $args = (object)$args;
        }
        
        if ($args && $args->theme_location != get_field('google_translate_menu', 'option')) {
            return $items;
        }

        //Not in child (if inherited from main)
        if ($args && (isset($args->child_menu) && $args->child_menu == true) && $args->theme_location == "main-menu") {
            return $items;
        }

        $label = 'Translate';
        if (get_field('google_translate_show_as', 'option') == 'icon') {
            $label = '<span data-tooltip="Translate"><i class="pricon pricon-globe"></i></span>';
        } elseif (get_field('google_translate_show_as', 'option') == 'combined') {
            $label = '<i class="pricon pricon-globe"></i> Translate';
        }

        $translate = '<li class="menu-item-translate"><a href="#translate" class="translate-icon-btn" aria-label="translate">' . $label . '</a></li>';

        if (isset($args->include_top_level)) {
            $items = $translate . $items;
        } else {
            $items .= $translate;
        }

        return $items;
    }
public function addTranslate ( $ items , $ args = null ) { if ( ! is_object ( $ args ) ) { $ args = ( object ) $ args ; } if ( $ args && $ args -> theme_location != get_field ( 'google_translate_menu' , 'option' ) ) { return $ items ; } //Not in child (if inherited from main) if ( $ args && ( isset ( $ args -> child_menu ) && $ args -> child_menu == true ) && $ args -> theme_location == "main-menu" ) { return $ items ; } $ label = 'Translate' ; if ( get_field ( 'google_translate_show_as' , 'option' ) == 'icon' ) { $ label = '<span data-tooltip="Translate"><i class="pricon pricon-globe"></i></span>' ; } elseif ( get_field ( 'google_translate_show_as' , 'option' ) == 'combined' ) { $ label = '<i class="pricon pricon-globe"></i> Translate' ; } $ translate = '<li class="menu-item-translate"><a href="#translate" class="translate-icon-btn" aria-label="translate">' . $ label . '</a></li>' ; if ( isset ( $ args -> include_top_level ) ) { $ items = $ translate . $ items ; } else { $ items .= $ translate ; } return $ items ; }
Appends translate icon to menu
@param  string $items  Items html
@param  array  $args   Menu args
@return string         Items html
Appends translate icon to menu