diff --git a/code/DMSSiteTreeExtension.php b/code/DMSSiteTreeExtension.php index 439fd0e..da015a7 100644 --- a/code/DMSSiteTreeExtension.php +++ b/code/DMSSiteTreeExtension.php @@ -76,4 +76,8 @@ class DMSSiteTreeExtension extends DataExtension { } } + + function getTitleWithNumberOfDocuments() { + return $this->owner->Title . ' (' . $this->owner->Documents()->Count() . ')'; + } } \ No newline at end of file diff --git a/code/cms/DMSDocumentAddExistingField.php b/code/cms/DMSDocumentAddExistingField.php index 4146431..fd60a1f 100644 --- a/code/cms/DMSDocumentAddExistingField.php +++ b/code/cms/DMSDocumentAddExistingField.php @@ -4,8 +4,8 @@ class DMSDocumentAddExistingField extends CompositeField { function __construct($name, $title = null) { $this->name = $name; $this->title = ($title === null) ? $name : $title; - - parent::__construct(new TreeDropdownField('PageSelector', 'Add from another page', 'SiteTree')); + + parent::__construct(new TreeDropdownField('PageSelector', 'Add from another page', 'SiteTree', 'ID', 'TitleWithNumberOfDocuments')); } /**