users_export.module in Users Export 8
Same filename and directory in other branches
Base module file for users_export.
users_export Users Export
File
users_export.moduleView source
<?php
/**
* @file
* Base module file for users_export.
*
* @defgroup users_export Users Export
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
/**
* Implements hook_users_export_row_alter().
*/
function users_export_users_export_row_alter(&$row, $uid, $context) {
$settings = $context['settings'];
// We'll assume we don't want this column unless the status is mixed.
if ($settings['status'] <= 1) {
unset($row['status']);
}
}
/**
* Implements hook_help().
*/
function users_export_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.users_export':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Provides a turn-key solution for exporting users in several different formats included Excel, CSV, JSON, tab-delimitted, and XML.') . '</p>';
$output .= '<h3>' . t('Use') . '</h3>';
$output .= '<dl>';
$output .= '<dt>- <i>' . t('Exporting') . '</i></dt>';
$output .= '<dd>' . t('Visit <a href="@url_export">admin/people/export</a>, adjust your settings and click Download File.', [
'@url_export' => Url::fromRoute('users_export.form')
->toString(),
]) . '</dd>';
$output .= '<dt>- <i>' . t('API') . '</i></dt>';
$output .= '<dd>' . t('Refer to <a href="@url_code" target="blank">users_export.api.php</a> for api functions and hooks.', [
'@url_code' => 'https://cgit.drupalcode.org/users_export/tree/users_export.api.php?h=8.x-1.x',
]) . '</dd>';
$output .= '</dl>';
return $output;
}
}
// TODO Advanced settings are not saved to config.
// TODO Export active and blocked does not work.
Functions
Name | Description |
---|---|
users_export_help | Implements hook_help(). |
users_export_users_export_row_alter | Implements hook_users_export_row_alter(). |