Permalink
Browse files

ENHANCEMENT Ensure that broken File links receive an "ss-broken" clas…

…s, just like broken SiteTree links
  • Loading branch information...
halkyon committed Mar 1, 2012
1 parent 898c8f5 commit f5c4bc0802062de3db60d1c45975d97140860c07
Showing with 8 additions and 1 deletion.
  1. +8 −1 forms/HtmlEditorField.php
@@ -69,8 +69,15 @@ function Field() {
$link->setAttribute('class', ($class ? "$class ss-broken" : 'ss-broken'));
}
}
+
+ if(preg_match('/\[file_link id=([0-9]+)\]/i', $link->getAttribute('href'), $matches)) {
+ if(!DataObject::get_by_id('File', $matches[1])) {
+ $class = $link->getAttribute('class');
+ $link->setAttribute('class', ($class ? "$class ss-broken" : 'ss-broken'));
+ }
+ }
}
-
+
return $this->createTag (
'textarea',
$this->getAttributes(),

0 comments on commit f5c4bc0

Please sign in to comment.