mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +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;
|
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) {
|
if($childData->ParentID) {
|
||||||
$folder = DataObject::get_by_id('File', $childData->ParentID );
|
$folder = DataObject::get_by_id('File', $childData->ParentID );
|
||||||
} else {
|
} else {
|
||||||
@ -207,10 +211,15 @@ class AssetTableField extends ComplexTableField {
|
|||||||
$links = $childData->BackLinkTracking();
|
$links = $childData->BackLinkTracking();
|
||||||
if(class_exists('Subsite')) Subsite::disable_subsite_filter(false);
|
if(class_exists('Subsite')) Subsite::disable_subsite_filter(false);
|
||||||
|
|
||||||
|
$linkArray = array();
|
||||||
if($links && $links->exists()) {
|
if($links && $links->exists()) {
|
||||||
$backlinks = array();
|
$backlinks = array();
|
||||||
foreach($links as $link) {
|
foreach($links as $link) {
|
||||||
|
// Avoid duplicates
|
||||||
|
if (!in_array($link->ID, $linkArray)) {
|
||||||
$backlinks[] = "<li><a href=\"admin/show/$link->ID\">" . $link->Breadcrumbs(null,true). "</a></li>";
|
$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>";
|
$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