Console
Console copied to clipboard
New report proposal - Help text who make the content editor crash
Hello,
I propose to add the following report in the content edit section to prevent the crashed of the content editor as described here: https://getfishtank.ca/en/blog/fixing-uncaught-syntaxerror-unexpected-identifier-and-cannot-read-property-reset-of-undefined
Regards,
Benjamin Vangansewinkel
<#`
.SYNOPSIS
Lists all content items that contain one some invalid character in the field title or the help texts because this make the
.NOTES
Benjamin Vangansewinkel
#>
filter Where-InvalidCharacterInFields {
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[Sitecore.Data.Items.Item]$item
)
if(($item["__Long description"] -Match '"') -or ($item["__Long description"] -Match "'")) {
Write-Host "Long description of item: $($item.Paths.FullPath)"
$field = $item.Fields["__Long description"]
@{Item = $item; Field = $field}
}
if(($item["__Short description"] -Match '"') -or ($item["__Short description"] -Match "'")) {
$field = $item.Fields["__Short description"]
@{Item = $item; Field = $field}
}
if(($item["Title"] -Match '"') -or ($item["Title"] -Match "'")) {
$field = $item.Fields["__Short description"]
@{Item = $item; Field = $field}
}
}
$items = Get-ChildItem -Path "master:/sitecore/templates/User Defined" -Recurse | Where-InvalidCharacterInFields
if($items.Count -eq 0) {
Show-Alert "There are no invalid help text"
} else {
$props = @{
Title = "Invalid help text Report"
InfoTitle = "Content items with invalid help text on fields"
InfoDescription = 'Lists all content field that contain single or double quote in the help text or in the title because this makes the content editor crash!'
PageSize = 25
}
$items |
Show-ListView @props -Property @{Label="Icon"; Expression={$_.Item.__Icon} },
@{Label="Name"; Expression={$_.Item.DisplayName} },
@{Label="Field Name"; Expression={$_.Field.Name} },
@{Label="Updated"; Expression={$_.Item.__Updated} },
@{Label="Updated by"; Expression={$_.Item."__Updated by"} },
@{Label="Created"; Expression={$_.Item.__Created} },
@{Label="Created by"; Expression={$_.Item."__Created by"} },
@{Label="Path"; Expression={$_.Item.ItemPath} }
}
Close-Window
@VGBenjamin Does this issue happen for specific versions of Sitecore?