mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-29 12:49:06 +02:00
Un-deprecated Object::add_extension() non-LSB usage (fixes #1710)
Its usage is too common to force-remove it just for a shortcut. We still recommend adding extensions through YAML of course.
This commit is contained in:
parent
9456b8043c
commit
1cfc159f1a
@ -450,8 +450,13 @@ abstract class Object {
|
||||
* @param string $extension Subclass of {@link Extension} with optional parameters
|
||||
* as a string, e.g. "Versioned" or "Translatable('Param')"
|
||||
*/
|
||||
public static function add_extension($extension) {
|
||||
$class = get_called_class();
|
||||
public static function add_extension($classOrExtension, $extension = null) {
|
||||
if(func_num_args() > 1) {
|
||||
$class = $classOrExtension;
|
||||
} else {
|
||||
$class = get_called_class();
|
||||
$extension = $classOrExtension;
|
||||
}
|
||||
|
||||
if(!preg_match('/^([^(]*)/', $extension, $matches)) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user