users_export.install in Users Export 8
Same filename and directory in other branches
Handles installation steps for users_export.
File
users_export.installView source
<?php
/**
* @file
* Handles installation steps for users_export.
*
* @ingroup users_export
*/
use Drupal\Core\Url;
/**
* Implements hook_install().
*/
function users_export_install() {
\Drupal::messenger()
->addStatus(t('You may export users by visiting <a href="@url" target="blank">@url</a>.', [
'@url' => Url::fromRoute('users_export.form')
->toString(),
]));
}
/**
* Implements hook_uninstall().
*/
function users_export_uninstall() {
\Drupal::configFactory()
->getEditable('users_export.settings')
->delete();
}
/**
* Implements hook_requirements().
*
* Checks installation requirements and do status reporting.
* http://api.drupal.org/api/function/hook_requirements.
*
* @codingStandardsIgnoreStart
*
* @param phase 'install' or 'runtime':
*
* @return A keyed array of requirements
*
*
* // TODO This is not ported yet.
*
* @codingStandardsIgnoreEnd
*/
function _users_export_requirements($phase) {
$reqs = [];
if ($phase == 'runtime') {
$modules = [];
if (!\Drupal::moduleHandler()
->moduleExists('loft_data_grids')) {
$modules[] = 'loft_data_grids';
}
if ($modules) {
$reqs['users_export'] = [
'title' => t('Users Export Dependencies'),
'description' => t('The following module(s) need to be enabled: %modules', [
'%modules' => implode(', ', $modules),
]),
'severity' => REQUIREMENT_ERROR,
'value' => t('Missing'),
];
}
if (!function_exists('loft_data_grids_info')) {
$reqs['users_export'] = [
'title' => t('Users Export'),
'description' => t('Please upgrade <a href="!url">Loft Data Grids</a> to the 2.x branch immediately!', [
'!url' => Url::fromUri('http://www.intheloftstudios.com/packages/php/drupal_loft_data_grids'),
]),
'severity' => REQUIREMENT_ERROR,
'value' => t('Outdated dependency'),
];
}
}
return $reqs;
}
Functions
Name | Description |
---|---|
users_export_install | Implements hook_install(). |
users_export_uninstall | Implements hook_uninstall(). |
_users_export_requirements | Implements hook_requirements(). |