• Resolved timholz

    (@timholz)


    For testing purposes i added the following function as is to my functions.php

    /**
     * @param int $display
     * @return MslsLink
     */
    function my_msls_link_create( $display ) {
        class MyMslsLink extends MslsLink {
            protected $format_string = '<img src="{src}" alt="{alt}"/> <span>{txt}</span>';
        }
        return new MyMslsLink;
    }
    add_filter( 'msls_link_create', 'my_msls_link_create' );

    I presumed that i could add width and height for the img tag, but this function throws a fatal error:

    Fatal error: Uncaught Error: Class 'MslsLink' not found in /Applications/MAMP/testdocs/wp-content/themes/archiv/functions.php:21 Stack trace: #0 /Applications/MAMP/testdocs/wp-includes/class-wp-hook.php(308): my_msls_link_create(2) #1 /Applications/MAMP/testdocs/wp-includes/plugin.php(205): WP_Hook->apply_filters(2, Array) #2 /Applications/MAMP/testdocs/wp-content/plugins/multisite-language-switcher/includes/MslsLink.php(84): apply_filters('msls_link_creat...', 2) #3 /Applications/MAMP/testdocs/wp-content/plugins/multisite-language-switcher/includes/MslsOutput.php(41): lloc\Msls\MslsLink::create(2) #4 /Applications/MAMP/testdocs/wp-content/themes/archiv/functions.php(51): lloc\Msls\MslsOutput->get(2) #5 /Applications/MAMP/testdocs/wp-includes/class-wp-hook.php(308): my_custom_menu_item('<li id="menu-it...', Object(stdClass)) #6 /Applications/MAMP/testdocs/wp-includes/plugin.php(205): WP_Hook->apply_filters('<li id="menu-it...', Array) #7 /Applications/MAMP/testdocs/wp-includes/nav-menu-template.php(273): apply_filters('wp in /Applications/MAMP/testdocs/wp-content/themes/archiv/functions.php on line 21

    Is there something i am missing in using ?msls_link_create?? Is my presumption to put the function in my functions.php wrong? By the way, i really appreciate this plugin. It’s a great feature to tie everything and dynamically switch languages. regards theo

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    The class MslsLink needs to be namespaced as \lloc\Msls\MslsLink. I just updated the documentation too.

    Thread Starter timholz

    (@timholz)

    Thanks for the update. It works. I can add the image dimensions to my custom flags, great. regards theo

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘fatal error for ?msls_link_create?’ is closed to new replies.