s.k.Soni
s.k.Soni

Reputation: 1310

What is @html.widget in nopcommerce?

I want to know that what is @html.widget in nopcommerce. What is the use of it? Why we use it?

in nopcommerce @html.widget is used many places let we talk about one place that is in header.cshtml page.

In nopcommerce there is one line in header.cshtml. i.e.

@html.widget("header_selectors")

Now, the question is that what is the purpose of this line. Because when I am remove this line there is no change at the client side. So why it is given in header.cshtml page.

Upvotes: 0

Views: 1507

Answers (1)

Raphael
Raphael

Reputation: 1040

You may take a look at Nop.Web.Framework/HtmlExtensions

public static MvcHtmlString Widget(this HtmlHelper helper, string widgetZone, object additionalData = null, string area = null)
{
    return helper.Action("WidgetsByZone", "Widget", new { widgetZone = widgetZone, additionalData = additionalData, area = area });
}

This extensions calls an action on the widget controller which uses the widget service to find all plugins providing additional content for the specified widget zone.

For example, you may want to add content to the footer without touching the theme. Therefor you can create a widget plugin adding content to 'footer' zone.

Upvotes: 2

Related Questions