7

I followed these instructions to add a text field to the internal General Link dialog which works fine.

But now I need a checkbox instead of a text field (anchor) but it still should add a tag with text in the link field like this in raw value view (data-name="teaser_a"):

<link text="Test" data-name="teaser_a" linktype="internal" class="" title="" target="" querystring="" id="{819BFAC1-A563-49DA-9C2C-E88D0B397618}" />

while teaser_a is the item name, which should automatically be added.

So instead of textbox rendering I would add a checkbox rendering to /sitecore/client/Applications/Dialogs/InsertLinkViaTreeDialog layout.

But after that I'm not entirely sure. I'll probably have to update the ReadQueryParamsAndUpdatePlaceholders method in InsertLinkDialogTreePageCode class and somehow get the item name.

The code in the example looks like this:

private void ReadQueryParamsAndUpdatePlaceholders()
{
    Original implementation
    {
        this.Anchor.Parameters["Text"] = GetXmlAttributeValue(element, "anchor");
    }
}

And than respectively alter the rule in MakeInternalLinkFromTreeView since it is not a textControl anymore. Code in example:

 ... anchor target name to [targetAnchorID,,,textControl6]'s text property ...

I'm new to SPEAK and the rule engine. Can someone point me into the right direction?

  • 1
    Gatogordo - I've implemented this general link textbox in our solution too but not as a checkbox as you've mentioned. I've not got that much experience with speak + rules engine I'm afraid even though I've built a speak app I didn't build it with binding like this via the rules engine. It's quite complicated I feel. Are you just trying to add an additional checkbox then to go below your textbox? – Adam Seabridge Oct 5 '16 at 17:25
  • I wanted to make it easy for the author. When the checkbox is checked the additional attribute will be populated all by itself. But since it is such a pain, I'll stick to the text box and we have to tutor the author what to put in there. Thanks – z00mable Oct 6 '16 at 8:45
1

Just a thought... Add a hidden textbox as described in the blog post and populate/clear it when the checked state of the checkbox changes. The other way around, check the checkbox if the hidden textbox isn't empty.

  • It's been a while since we developed this feature so I won't change it now. But good idea. Thank you. – z00mable Jan 13 '17 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.