WordPress do_shortcode work in one widget but not another

I have a couple of shortcodes that I wan’t to be able to use in my widgets. I’ve added add_filter('widget_text', 'do_shortcode'); to functions.php (theme) and it works well when I use the default WP “Text” widget. But when I try the shortcodes in my own widgets (I’ve developed them myself) they don’t work, they are rendered as regular content.
I guess I’ve missed a render function or something like that, but hours searching and comparing to the WP Text source don’t get me anywhere. Any ideas?

// Display text
if($instance['text']!="") {
    echo "n<p class="lead">" . str_replace("n", "</p><p class="lead">", $instance['text']) . "</p>n";
}


Source: shortcode

Leave a Reply