Browse Source

Merge pull request #139 from willtp87/ISLANDORA-581

ISLANDORA-581 On content model trigered tabs we use module_exists to ver...
pull/140/merge
Jonathan Green 13 years ago
parent
commit
7c9aefc8ec
  1. 13
      ContentModel.inc

13
ContentModel.inc

@ -1475,7 +1475,17 @@ 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);
$file_extension = pathinfo($method->getAttribute('file'), PATHINFO_EXTENSION);
$file_path_without_extension = $method->getAttribute('file');
/* Only in PHP. This is meant to avoid file path
* concatenation issues.*/
$file_path_without_extension = substr($file_path_without_extension, 0, strlen($file_path_without_extension) - (strlen($file_extension) + 1));
/* Only try to execute if the module is present, this is
* necessarybecause we go outside of the expected
* 'Drupal Way' and have dynamic dependencies.*/
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'); $className = $method->getAttribute('class');
$methodName = ($method->getAttribute('method')); $methodName = ($method->getAttribute('method'));
if (!class_exists($className)) { if (!class_exists($className)) {
@ -1496,6 +1506,7 @@ class ContentModel extends XMLDatastream {
} }
} }
} }
}
return $output; return $output;
} }

Loading…
Cancel
Save