mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +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
|
* @param string $extension Subclass of {@link Extension} with optional parameters
|
||||||
* as a string, e.g. "Versioned" or "Translatable('Param')"
|
* as a string, e.g. "Versioned" or "Translatable('Param')"
|
||||||
*/
|
*/
|
||||||
public static function add_extension($extension) {
|
public static function add_extension($classOrExtension, $extension = null) {
|
||||||
$class = get_called_class();
|
if(func_num_args() > 1) {
|
||||||
|
$class = $classOrExtension;
|
||||||
|
} else {
|
||||||
|
$class = get_called_class();
|
||||||
|
$extension = $classOrExtension;
|
||||||
|
}
|
||||||
|
|
||||||
if(!preg_match('/^([^(]*)/', $extension, $matches)) {
|
if(!preg_match('/^([^(]*)/', $extension, $matches)) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user