function theme_uc_file_hook_user_file_downloads in Ubercart 8.4
Same name and namespace in other branches
- 6.2 uc_file/uc_file.module \theme_uc_file_hook_user_file_downloads()
- 7.3 uc_file/uc_file.theme.inc \theme_uc_file_hook_user_file_downloads()
Themes the download table at the user account page.
Parameters
array $variables: An associative array containing:
- form: A render element representing the form.
Return value
string Formatted HTML.
1 string reference to 'theme_uc_file_hook_user_file_downloads'
- uc_file_theme in uc_file/
uc_file.module - Implements hook_theme().
File
- uc_file/
uc_file.theme.inc, line 22 - Theme functions for the uc_file module.
Code
function theme_uc_file_hook_user_file_downloads(array $variables) {
$form = $variables['form'];
$header = [
[
'data' => t('Remove'),
],
[
'data' => t('Filename'),
],
[
'data' => t('Expiration'),
],
[
'data' => t('Downloads'),
],
[
'data' => t('Addresses'),
],
];
$rows = [];
foreach (Element::children($form['file_download']) as $key) {
if (!isset($form['file_download'][$key]['addresses_in'])) {
continue;
}
$file_download =& $form['file_download'][$key];
$rows[] = [
'data' => [
[
'data' => $file_download['remove'],
],
[
'data' => $file_download['filename'],
],
[
'data' => [
'#type' => 'container',
'#prefix' => drupal_render($file_download['expires']) . ' <br />',
'time' => [
'polarity' => $file_download['time_polarity'],
'quantity' => $file_download['time_quantity'],
'granularity' => $file_download['time_granularity'],
],
],
'class' => [
'duration',
],
],
[
'data' => [
'#type' => 'container',
'#markup' => drupal_render($file_download['downloads_in']) . '/',
'limit' => $file_download['download_limit'],
],
'class' => [
'download-table-index',
],
],
[
'data' => [
'#type' => 'container',
'#markup' => drupal_render($file_download['addresses_in']) . '/',
'limit' => $file_download['address_limit'],
],
'class' => [
'download-table-index',
],
],
],
'class' => [
'download-table-row',
],
];
}
$build = [
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
'#attributes' => [
'id' => 'download-table',
],
'#empty' => t('No files can be downloaded by this user.'),
];
return drupal_render($build);
}