diff --git a/core/Extension.php b/core/Extension.php index 89e0b17a7..deb5b1b91 100644 --- a/core/Extension.php +++ b/core/Extension.php @@ -1,7 +1,12 @@ owner; } + + /** + * Helper method to strip eval'ed arguments from a string + * thats passed to {@link DataObject::$extensions} or + * {@link Object::add_extension()}. + * + * @param string $extensionStr E.g. "Versioned('Stage','Live')" + * @return string Extension classname, e.g. "Versioned" + */ + public static function get_classname_without_arguments($extensionStr) { + return (($p = strpos($extensionStr, '(')) !== false) ? substr($extensionStr, 0, $p) : $extensionStr; + } + } ?> \ No newline at end of file