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:
Ingo Schommer 2013-04-09 14:56:26 +02:00
parent 9456b8043c
commit 1cfc159f1a

View File

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