5 * Install, update and uninstall functions for the Superfish module.
8 use Drupal\Core\Language\Language;
11 * Implements hook_enable().
13 function superfish_install() {
14 if (superfish_library_check()){
15 drupal_set_message(t('In order to use Superfish, go to the <a href="@block">Block layout</a> page and use any of the "Place block" buttons to create a Superfish block.', array('@block' => 'structure/block')));
17 drupal_set_message(t('Superfish library is missing. Please refer to the <a href="@documentation">plugin documentation</a> for how you can fix this issue; Once done, go to the <a href="@block">Block layout</a> page and use any of the "Place block" buttons to create a Superfish block.', array('@documentation' => 'http://drupal.org/node/1125896', '@block' => 'structure/block')), 'warning');
22 * Implements hook_requirements().
24 function superfish_requirements($phase) {
25 $requirements = array();
26 if ($phase == 'runtime') {
27 $requirements['superfish']['title'] = t('Superfish library');
29 if (superfish_library_check()) {
30 $requirements['superfish']['value'] = t('Installed at @location', array('@location' => superfish_library_path()));
31 $requirements['superfish']['severity'] = REQUIREMENT_OK;
34 $requirements['superfish']['value'] = t('Not installed');
35 $requirements['superfish']['severity'] = REQUIREMENT_ERROR;
36 $requirements['superfish']['description'] = t('Please download the Superfish library from :url.', array(':url' => 'http://drupal.org/project/superfish'));
39 // Check the uploaded Superfish library version.
40 if (($version = superfish_library_version()) && $version != '2.0') {
41 $requirements['superfish']['value'] = t('Not supported');
42 $requirements['superfish']['severity'] = REQUIREMENT_ERROR;
43 $requirements['superfish']['description'] = t('The Superfish library requires an update. You can find the update instructions on :url.', array(':url' => 'http://drupal.org/project/superfish'));