Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Glass.Mapper在BeginRenderLink方法中不应用其他参数_C#_Sitecore_Glass Mapper - Fatal编程技术网

C# Glass.Mapper在BeginRenderLink方法中不应用其他参数

C# Glass.Mapper在BeginRenderLink方法中不应用其他参数,c#,sitecore,glass-mapper,C#,Sitecore,Glass Mapper,对于Glass.MapperBeginRenderLink,描述为呈现应包含多个HTML元素的链接的方法: 我想向该链接添加自定义属性(类、样式): <% using (BeginRenderLink(x => x.Image1Link, new NameValueCollection { { "class", "image-banner" }, { "style", string.Format("background-imag

对于Glass.MapperBeginRenderLink,描述为呈现应包含多个HTML元素的链接的方法:

我想向该链接添加自定义属性(类、样式):

    <% using (BeginRenderLink(x => x.Image1Link, 
           new NameValueCollection 
           { { "class", "image-banner" }, { "style", string.Format("background-image: url({0})", Model.Image1.Src) } }, true))
       { %>
    <span class="image-banner-wrapper">
        <span class="image-banner-content"><%= Editable(x => x.Image1Text) %></span>
    </span>
    <% } %>
因此,如果是编辑模式,则不应用其他属性,只传递“haschilds=true”


我想知道是否有人以某种方式解决了这个问题?

因为这似乎是玻璃的一个已知问题,并且已经有一个拉取请求等待处理()

我想修复它的唯一方法是从GitHub获得最新版本,进行修复并用修复重新编译玻璃。否则,您可以等待pull请求获得批准并更新您的Glass版本。正如您所看到的,修复并没有那么难(取自:

    if (IsInEditingMode && isEditable)
    {
        return MakeEditable(field, null, model, "haschildren=true", _context, SitecoreContext.Database, writer);
    }
    else
    {
        return BeginRenderLink(field.Compile().Invoke(model) as Fields.Link, attrs, string.Empty, writer);
    }
if (IsInEditingMode && isEditable)
{   
    if (attrs != null)
    {
        attrs.Add("haschildren", "true");
        return MakeEditable(field, null, model, attrs, _context, SitecoreContext.Database, writer);
    }

    return MakeEditable(field, null, model, "haschildren=true", _context, SitecoreContext.Database, writer);
 }