function hook_mail_safety_table_structure_alter in Mail Safety 7
Same name and namespace in other branches
- 8 mail_safety.api.php \hook_mail_safety_table_structure_alter()
- 7.2 mail_safety.api.php \hook_mail_safety_table_structure_alter()
Alter the table structure of the mail safety dashboard.
Parameters
array $table_structure: The table structure that will be rendered as table.
1 invocation of hook_mail_safety_table_structure_alter()
- mail_safety_admin_dashboard_form in ./
mail_safety.admin.inc - Form constructor for the dashboard of Mail Safety.
File
- ./
mail_safety.api.php, line 95 - Hooks provided by the Mail Safety module.
Code
function hook_mail_safety_table_structure_alter($table_structure) {
// Add a new column.
$table_structure['header'][] = array(
'data' => t('Files'),
);
// Loop through the mails to add the attachments in the table.
foreach ($table_structure['rows'] as $mail_id => $row) {
$mail = mail_safety_load($mail_id);
if (!empty($mail['mail']['attachments'])) {
$attachments = array();
foreach ($mail['mail']['attachments'] as $attachment) {
$attachments[] = array(
'#theme' => 'file_link',
'#file' => $attachment,
);
}
}
$table_structure['rows'][$mail_id]['data'][] = $attachments;
}
return $table_structure;
}