Sanitise GridFieldAddNewMultiClassHandler::Link()

This commit is contained in:
Damian Mooyman 2017-07-06 17:27:07 +12:00
parent 08ccb15bdb
commit 57acb83546
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
2 changed files with 15 additions and 3 deletions

View File

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

View File

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