ENHANCEMENT: Show number of documents on a page in dropdown

This commit is contained in:
Andrew O'Neil 2012-08-14 11:45:16 +12:00
parent 3af703fa9a
commit a6f8b83e1a
2 changed files with 6 additions and 2 deletions

View File

@ -76,4 +76,8 @@ class DMSSiteTreeExtension extends DataExtension {
}
}
function getTitleWithNumberOfDocuments() {
return $this->owner->Title . ' (' . $this->owner->Documents()->Count() . ')';
}
}

View File

@ -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'));
}
/**