Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
41
vendor/chi-teck/drupal-code-generator/templates/d8/hook/mail.twig
vendored
Normal file
41
vendor/chi-teck/drupal-code-generator/templates/d8/hook/mail.twig
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Implements hook_mail().
|
||||
*/
|
||||
function {{ machine_name }}_mail($key, &$message, $params) {
|
||||
$account = $params['account'];
|
||||
$context = $params['context'];
|
||||
$variables = [
|
||||
'%site_name' => \Drupal::config('system.site')->get('name'),
|
||||
'%username' => $account->getDisplayName(),
|
||||
];
|
||||
if ($context['hook'] == 'taxonomy') {
|
||||
$entity = $params['entity'];
|
||||
$vocabulary = Vocabulary::load($entity->id());
|
||||
$variables += [
|
||||
'%term_name' => $entity->name,
|
||||
'%term_description' => $entity->description,
|
||||
'%term_id' => $entity->id(),
|
||||
'%vocabulary_name' => $vocabulary->label(),
|
||||
'%vocabulary_description' => $vocabulary->getDescription(),
|
||||
'%vocabulary_id' => $vocabulary->id(),
|
||||
];
|
||||
}
|
||||
|
||||
// Node-based variable translation is only available if we have a node.
|
||||
if (isset($params['node'])) {
|
||||
/** @var \Drupal\node\NodeInterface $node */
|
||||
$node = $params['node'];
|
||||
$variables += [
|
||||
'%uid' => $node->getOwnerId(),
|
||||
'%url' => $node->url('canonical', ['absolute' => TRUE]),
|
||||
'%node_type' => node_get_type_label($node),
|
||||
'%title' => $node->getTitle(),
|
||||
'%teaser' => $node->teaser,
|
||||
'%body' => $node->body,
|
||||
];
|
||||
}
|
||||
$subject = strtr($context['subject'], $variables);
|
||||
$body = strtr($context['message'], $variables);
|
||||
$message['subject'] .= str_replace(["\r", "\n"], '', $subject);
|
||||
$message['body'][] = MailFormatHelper::htmlToText($body);
|
||||
}
|
Reference in a new issue