mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Argument checks in AssetTableField->getCustomFieldsFor() (AIR-40)
This commit is contained in:
parent
3809c1614f
commit
de13f144fa
@ -149,6 +149,10 @@ class AssetTableField extends ComplexTableField {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!$childData instanceof File) {
|
||||
throw new InvalidArgumentException(sprintf('$childData is of class "%s", subclass of "File" expected', get_class($childData)));
|
||||
}
|
||||
|
||||
if($childData->ParentID) {
|
||||
$folder = DataObject::get_by_id('File', $childData->ParentID );
|
||||
} else {
|
||||
@ -207,10 +211,15 @@ class AssetTableField extends ComplexTableField {
|
||||
$links = $childData->BackLinkTracking();
|
||||
if(class_exists('Subsite')) Subsite::disable_subsite_filter(false);
|
||||
|
||||
$linkArray = array();
|
||||
if($links && $links->exists()) {
|
||||
$backlinks = array();
|
||||
foreach($links as $link) {
|
||||
$backlinks[] = "<li><a href=\"admin/show/$link->ID\">" . $link->Breadcrumbs(null,true). "</a></li>";
|
||||
// Avoid duplicates
|
||||
if (!in_array($link->ID, $linkArray)) {
|
||||
$backlinks[] = "<li><a href=\"admin/show/$link->ID\">" . $link->Breadcrumbs(null,true). "</a></li>";
|
||||
$linkArray[] = $link->ID;
|
||||
}
|
||||
}
|
||||
$backlinks = "<div style=\"clear:left\">". _t('AssetTableField.PAGESLINKING','The following pages link to this file:') ."<ul>" . implode("",$backlinks) . "</ul></div>";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user