diff --git a/_config.php b/_config.php
index 1703523..a1eaa70 100644
--- a/_config.php
+++ b/_config.php
@@ -13,7 +13,9 @@ if (!file_exists(BASE_PATH . DIRECTORY_SEPARATOR . DMS_DIR)) user_error("DMS dir
CMSMenu::remove_menu_item('DMSDocumentAddController');
-ShortcodeParser::get('default')->register('dms_document_link', array('DMSDocument_Controller', 'dms_link_shortcode_handler'));
+ShortcodeParser::get('default')->register(
+ 'dms_document_link', array('DMSShortcodeHandler', 'handle')
+);
if ($config->get('DMSDocument_versions', 'enable_versions')) {
//using the same db relations for the versioned documents, as for the actual documents
diff --git a/code/DMSDocument.php b/code/DMSDocument.php
index 9eb3be8..83eaf61 100755
--- a/code/DMSDocument.php
+++ b/code/DMSDocument.php
@@ -916,34 +916,5 @@ class DMSDocument_Controller extends ContentController {
$this->httpError(404, 'This asset does not exist.');
}
-
- /**
- * Handles dms_document_link shortcode
- * @return string
- */
- public static function dms_link_shortcode_handler($arguments, $content = null, $parser = null) {
- $linkText = null;
-
- if (!empty($arguments['id'])) {
- $document = DMSDocument::get()->filter(array('ID' => $arguments['id']))->First();
- if ($document && !$document->isHidden()) {
- if (!empty($content)) {
- $linkText = sprintf('%s', $document->Link(), $parser->parse($content));
- } else {
- $linkText = $document->Link();
- }
- }
- }
-
- if (empty($linkText)) {
- $errorPage = ErrorPage::get()->filter(array('ErrorCode' => '404'))->First();
- if ($errorPage) {
- $linkText = $errorPage->Link();
- }
- }
-
- return $linkText;
- }
-
}
diff --git a/code/DMSShortcodeHandler.php b/code/DMSShortcodeHandler.php
new file mode 100644
index 0000000..452814f
--- /dev/null
+++ b/code/DMSShortcodeHandler.php
@@ -0,0 +1,32 @@
+filter(array('ID' => $arguments['id']))->First();
+ if ($document && !$document->isHidden()) {
+ if (!empty($content)) {
+ $linkText = sprintf('%s', $document->Link(), $parser->parse($content));
+ } else {
+ $linkText = $document->Link();
+ }
+ }
+ }
+
+ if (empty($linkText)) {
+ $errorPage = ErrorPage::get()->filter(array('ErrorCode' => '404'))->First();
+ if ($errorPage) {
+ $linkText = $errorPage->Link();
+ }
+ }
+
+ return $linkText;
+ }
+
+}