mmenu.install in Mobile sliding menu 8
Same filename and directory in other branches
Install and uninstall functions for the mobile sliding menu module.
File
mmenu.installView source
<?php
/**
* @file
* Install and uninstall functions for the mobile sliding menu module.
*/
/**
* Implements hook_install().
*/
function mmenu_install() {
}
/**
* Implements hook_uninstall().
*
* Removes variables on uninstall.
*/
function mmenu_uninstall() {
// Deletes mmenu.settings.
\Drupal::configFactory()
->getEditable('mmenu.settings')
->delete();
// Clears mmenus cache.
\Drupal::cache()
->delete('mmenus:cache');
}
/**
* Implements hook_requirements().
*/
function mmenu_requirements($phase) {
$requirements = array();
switch ($phase) {
case 'runtime':
$library_main = libraries_detect('mmenu.main');
$library_hammer = libraries_detect('mmenu.hammer');
$library_jquery_hammer = libraries_detect('mmenu.jquery.hammer');
$description_installed = t('To check for newer versions of Mmenu, go to <a href=":url" target="_blank">:url</a>.', array(
":url" => $library_main['vendor url'],
));
$description_missing = t('To check for newer versions of Mmenu, go to <a href=":lib_url" target="_blank">:lib_url</a>. The Mmenu library was not detected. Please follow the instructions on the <a href=":url" target="_blank">Mmenu project page</a> to install the Mmenu library.', array(
":lib_url" => $library_main['vendor url'],
":url" => 'http://drupal.org/project/mmenu',
));
if (!empty($library_main['installed'])) {
$requirements['mmenu_main_version'] = array(
'title' => t('Mmenu: Main'),
'value' => $library_main['version'],
'description' => $description_installed,
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['mmenu_main_library'] = array(
'title' => t('Mmenu: Main'),
'value' => t('Missing'),
'description' => $description_missing,
'severity' => REQUIREMENT_ERROR,
);
}
$description_installed = t('To check for newer versions of Hammer.js, go to <a href=":url" target="_blank">:url</a>.', array(
":url" => $library_hammer['vendor url'],
));
$description_missing = t('To check for newer versions of Hammer.js, go to <a href=":lib_url" target="_blank">:lib_url</a>. The Hammer.js library was not detected. Please follow the instructions on the <a href=":url" target="_blank">Mmenu project page</a> to install the library.', array(
":lib_url" => $library_hammer['vendor url'],
":url" => 'http://drupal.org/project/mmenu',
));
if (!empty($library_hammer['installed'])) {
$requirements['mmenu_hammer_version'] = array(
'title' => t('Mmenu: Hammer.js'),
'value' => $library_hammer['version'],
'description' => $description_installed,
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['mmenu_hammer_library'] = array(
'title' => t('Mmenu: Hammer.js'),
'value' => t('Missing'),
'description' => $description_missing,
'severity' => REQUIREMENT_ERROR,
);
}
$description_installed = t('To check for newer versions of jQuery plugin for Hammer.js, go to <a href=":url" target="_blank">:url</a>.', array(
":url" => $library_jquery_hammer['vendor url'],
));
$description_missing = t('To check for newer versions of jQuery plugin for Hammer.js, go to <a href=":lib_url" target="_blank">:lib_url</a>. The jQuery plugin for Hammer.js library was not detected. Please follow the instructions on the <a href=":url" target="_blank">Mmenu project page</a> to install the library.', array(
":lib_url" => $library_jquery_hammer['vendor url'],
":url" => 'http://drupal.org/project/mmenu',
));
if (!empty($library_jquery_hammer['installed'])) {
$requirements['mmenu_jquery_hammer_version'] = array(
'title' => t('Mmenu: jQuery plugin for Hammer.js'),
'value' => $library_jquery_hammer['version'],
'description' => $description_installed,
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['mmenu_jquery_hammer_library'] = array(
'title' => t('Mmenu: jQuery plugin for Hammer.js'),
'value' => t('Missing'),
'description' => $description_missing,
'severity' => REQUIREMENT_ERROR,
);
}
break;
}
return $requirements;
}
Functions
Name | Description |
---|---|
mmenu_install | Implements hook_install(). |
mmenu_requirements | Implements hook_requirements(). |
mmenu_uninstall | Implements hook_uninstall(). |