You can access Rendering Parameters in the backend code (controller/repository or view) easily in SXA. This is a view for Title rendering:
@model Sitecore.XA.Foundation.Variants.Abstractions.Models.VariantsRenderingModel
<div @Html.Sxa().Component(Model.Rendering.RenderingCssClass ?? "title", Model.Attributes)>
<div class="component-content">
@foreach (BaseVariantField variantField in Model.VariantFields)
{
@Html.RenderingVariants().RenderVariant(variantField, Model.Item, Model.RenderingWebEditingParams, Model)
}
</div>
</div>
VariantsRenderingModel
contains a list of variant fields so you can use them right away (and this is what we are doing there). This model class inherits from RenderingModelBase
which has plenty of data. One of that is a Rendering
object which has Parameters
collection. This is a collection of rendering parameters. You can access them on the view like that:
<div>@Model.Rendering.Parameters["MY_CUSTOM_RENDERING_PARAMETER_NAME"]</div>
This is how you are accessing the rendering parameres on the view.
Now... with the $item.Name
which you have there. What did you want to achieve by doing this?