1

Is it possible to have an image in Sitecore PowerShell Extensions GUI that has an embedded hyperlink to open a web page? For instance, if I had an image of a car in a PowerShell GUI form and when a user clicks the image, it would open https://cars.com.

1
  • 3
    I’m voting to close this question because it is not related to sitecore cms. Apr 5 at 15:52

2 Answers 2

3

It is possible to add a hyperlink to the dialog produced by Read-Variable.

Example: The following example produces a dialog with a hyperlink.

$props = @{
    "Parameters" = @(
        @{ Name = "info"; Title = "Fancy Link"; Value = "<a href='https://www.google.com' target='_blank'>CLICK ME</a>"; Editor = "info" }
    )
    "Title" = "Sample Download Wizard"
    "Icon" = "OfficeWhite/32x32/server_from_client.png"
    "ShowHints" = $true
    "OkButtonName" = "Next"
}
Read-Variable @props

Example Dialog

1
  • What version of powershell are you running? When I try the Read-Variable, I get that it isn't a cmdlet or fuction.... I'm running powershell 7
    – Todd
    Apr 5 at 15:19
0

Adding more to @Michael answer, So if you want to add image then you can add the path of your media library item like below.

    $props = @{
    "Parameters" = @(
        @{ Name = "info"; Title = "Image With Link"; Value = "<a href='https://cars.com' target='_blank'><img src='/-/media/Default Website/sc_logo.jpg'></a>"; Editor = "info" }
    )
    "Title" = "Sample Download Wizard"
    "Icon" = "OfficeWhite/32x32/server_from_client.png"
    "ShowHints" = $true
    "OkButtonName" = "Next"
    }
    Read-Variable @props

It will look like the below.

enter image description here

Hope it help.

2
  • ok I feel a bit silly. I think i'm posting in the wrong group. I don't use Sitecore....This is just straight powershell. Sorry for any inconvenience.
    – Todd
    Apr 5 at 15:31
  • @Todd No worry, at least it will be helpful for someone else. Apr 5 at 16:41

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