diff --git a/src/GridFieldAddNewMultiClass.php b/src/GridFieldAddNewMultiClass.php index 7aa7f2a..38ce6c9 100755 --- a/src/GridFieldAddNewMultiClass.php +++ b/src/GridFieldAddNewMultiClass.php @@ -265,7 +265,8 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL * Sanitise a model class' name for inclusion in a link * @return string */ - protected function sanitiseClassName($class) { + protected function sanitiseClassName($class) + { return str_replace('\\', '-', $class); } @@ -273,7 +274,8 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL * Unsanitise a model class' name from a URL param * @return string */ - protected function unsanitiseClassName($class) { + protected function unsanitiseClassName($class) + { return str_replace('-', '\\', $class); } } diff --git a/src/GridFieldAddNewMultiClassHandler.php b/src/GridFieldAddNewMultiClassHandler.php index 4d4f3b3..f97bfdf 100644 --- a/src/GridFieldAddNewMultiClassHandler.php +++ b/src/GridFieldAddNewMultiClassHandler.php @@ -19,8 +19,18 @@ class GridFieldAddNewMultiClassHandler extends GridFieldDetailForm_ItemRequest return Controller::join_links( $this->gridField->Link(), 'add-multi-class', - get_class($this->record) + $this->sanitiseClassName(get_class($this->record)) ); } } + + + /** + * Sanitise a model class' name for inclusion in a link + * @return string + */ + protected function sanitiseClassName($class) + { + return str_replace('\\', '-', $class); + } }