# Page Editor

## Notification

The *Notification* integration reveals to the user a notification above the content. The Sitecore rules engine may be used to control the enabled state; simply configure the **Enable** rule on the script. The script is executed every time the page loads.

![A Notification for the current date](https://165468320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LA37Eh9vuWwQHUTc2NT%2Fuploads%2Fgit-blob-9ccecf8318275585cda75fa1874f6e7d23b12958%2Fnotification-information.png?alt=media\&token=1d248d7f-b209-43bc-86aa-5e65ea1cfc83)

**Example:** The following adds an information notification to the page for Sitecore 8 and a warning for Sitecore 7.

```powershell
$title = "Thank you for using SPE!"
$text = "Today is $([datetime]::Now.ToLongDateString())"
$icon = @{$true="Office/32x32/information.png";$false="Applications/16x16/warning.png"}[$SitecoreVersion.Major -gt 7]

$notification = New-Object -TypeName Sitecore.Pipelines.GetPageEditorNotifications.PageEditorNotification -ArgumentList $text, "Info"

$notification.Icon = $icon
$pipelineArgs.Notifications.Add($notification)
```

**Note:** Examples included in the following modules

* License Expiration

## Experience Button

The *Experience Button* integration adds a button to the Page Editor. Rules can be used to control visiblity and enablement. The script is only executed when the button is clicked.

1. Begin by adding a new script to the *Experience Button* library. The name of the script will appear in the tooltip.
2. Edit the script to perform the appropriate actions. The script can run in the background and show dialogs.
3. Change the icon of the item to match the script purpose.
4. Configure any **Enable** or **Show** rules as needed.

![An Experience Button for sending emails](https://165468320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LA37Eh9vuWwQHUTc2NT%2Fuploads%2Fgit-blob-1bafee3dae8ac4f792decde81497650fedc1d1b3%2Fexperience-button-with-tooltip.png?alt=media)

**Example:** The following adds a command which will display a dialog asking a question, then send an email with the response.

```powershell
$item = Get-Item -Path .
$response = Show-Input -Prompt "What's the message for $($item.Name)?"
if($response) {
    $mailSettings = @{
        To = @("Michael West < mw@test.com >")
        From = "Console < noreply@test.com >"
        BodyAsHtml = $true
        SmtpServer = "localhost"
    }

    $subject = "Message sent regarding item $($item.Name) from $($SitecoreAuthority)"
    $response += "<br/>$($item.ItemPath)"
    Send-MailMessage @mailSettings -Subject $subject -Body $response
}

Close-Window
```

![Message Input](https://165468320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LA37Eh9vuWwQHUTc2NT%2Fuploads%2Fgit-blob-a25351ec4a8c687af6b336c6d328c941dba50666%2Fmessage-input-with-ok-cancel.png?alt=media)

![Email Response](https://165468320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LA37Eh9vuWwQHUTc2NT%2Fuploads%2Fgit-blob-4176a3d470ea1f8e53ae9d02305b0c5fe84bf18a%2Fpapercut-email-response.png?alt=media)
