From b561d4b72f50f9b5a7e3c510653283610b5c9097 Mon Sep 17 00:00:00 2001 From: Peter Murray Date: Wed, 27 Feb 2013 17:06:39 -0500 Subject: [PATCH] Move XSLTProcessor class check to hook_requirements() --- includes/admin.form.inc | 5 ----- islandora.install | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/includes/admin.form.inc b/includes/admin.form.inc index 493b9017..5939d55b 100644 --- a/includes/admin.form.inc +++ b/includes/admin.form.inc @@ -20,11 +20,6 @@ function islandora_repository_admin(array $form, array &$form_state) { module_load_include('inc', 'islandora', 'includes/utilities'); drupal_add_css(drupal_get_path('module', 'islandora') . '/css/islandora.admin.css'); - if (!class_exists('XSLTProcessor', FALSE)) { - $link = l(t('PHP XSL extension'), 'http://us2.php.net/manual/en/book.xsl.php', array('attributes' => array('target'=>'_blank'))); - drupal_set_message(t('The !xsllink is required. Check your installed PHP extensions and php.ini file.', array('!xsllink' => $link)),'error'); - } - $form = array(); if (isset($form_state['values']['islandora_base_url'])) { $url = $form_state['values']['islandora_base_url']; diff --git a/islandora.install b/islandora.install index 321f6f46..10322ba9 100644 --- a/islandora.install +++ b/islandora.install @@ -4,6 +4,25 @@ * @file * This file contains all install related hooks. */ + +/** + * Implements hook_requirements(). + */ +function islandora_requirements($phase) { + $requirements = array(); + // Ensure translations don't break at install time + $t = get_t(); + + if (!class_exists('XSLTProcessor', FALSE)) { + $requirements['islandora_xsltprocessor']['title'] = $t('Islandora XSLTProcessor Prerequisite'); + $requirements['islandora_xsltprocessor']['value'] = $t('Not installed'); + $link = l($t('PHP XSL extension'), 'http://us2.php.net/manual/en/book.xsl.php', array('attributes' => array('target'=>'_blank'))); + $requirements['islandora_xsltprocessor']['description'] = $t('The !xsllink is required. Check your installed PHP extensions and php.ini file.', array('!xsllink' => $link)),'error'); + $requirements['islandora_xsltprocessor']['severity'] = REQUIREMENT_ERROR; + } + + return $requirements; +} /** * Implements hook_install().