@ -1475,19 +1475,30 @@ class ContentModel extends XMLDatastream {
self::$errors[] = 'Execute Form Handler: file \'' . $path . '\' does not exist.';
self::$errors[] = 'Execute Form Handler: file \'' . $path . '\' does not exist.';
}
}
else {
else {
require_once($path);
$className = $method->getAttribute('class');
$file_extension = pathinfo($method->getAttribute('file'), PATHINFO_EXTENSION);
$methodName = ($method->getAttribute('method'));
$file_path_without_extension = $method->getAttribute('file');
if (!class_exists($className)) {
/* Only in PHP. This is meant to avoid file path
self::$errors[] = 'Execute Form Handler: class \'' . $className . '\' does not exist.';
* concatenation issues.*/
}
$file_path_without_extension = substr($file_path_without_extension, 0, strlen($file_path_without_extension) - (strlen($file_extension) + 1));
else {
/* Only try to execute if the module is present, this is
$class = new $className($pid);
* necessarybecause we go outside of the expected
if (!method_exists($class, $methodName)) {
* 'Drupal Way' and have dynamic dependencies.*/
self::$errors[] = 'Execute Form Handler: method \'' . $className . '->' . $methodName . '\' does not exist.';
if (module_exists(!empty($module) ? $module : 'fedora_repository')) {
module_load_include($file_extension, !empty($module) ? $module : 'fedora_repository', $file_path_without_extension);
$className = $method->getAttribute('class');
$methodName = ($method->getAttribute('method'));
if (!class_exists($className)) {
self::$errors[] = 'Execute Form Handler: class \'' . $className . '\' does not exist.';
}
}
else {
else {
$output = $class->$methodName($page_number);
$class = new $className($pid);
if (!method_exists($class, $methodName)) {
self::$errors[] = 'Execute Form Handler: method \'' . $className . '->' . $methodName . '\' does not exist.';
}
else {
$output = $class->$methodName($page_number);
}
}
}
}
}
}
}