Issue #3404625: Added display of TWIG variables in the BodyEmailAdjuster.
12 open threads
Merge request reports
Activity
- Resolved by Adam Shepherd
- Resolved by Adam Shepherd
- Resolved by Adam Shepherd
- Resolved by Adam Shepherd
added 1 commit
116 125 * 117 126 * @return array 118 127 * An array of common adjuster IDs. 128 * 129 * @deprecated in symfony_mailer:1.4.1 and is removed from symfony_mailer:2.0.0. 130 * Use getBuilderDefinition() instead. 131 * 132 * @see https://www.drupal.org/project/symfony_mailer/issues/3404625 64 64 ]; 65 65 66 66 // @todo Show the available Twig variables / token browser. 67 if ($builder_definition = $form_state->getValue('builder_definition')) { 68 $variables = $builder_definition['variables']; 69 $output = []; 70 $output[] = [ 71 '#markup' => '<p>' . $this->t("The following replacement tokens are available for this field.") . '</p>', 72 ]; 73 $items = []; 74 foreach ($variables as $key => $value) { 75 if (!empty($variables[$key])) { 68 $variables = $builder_definition['variables']; 69 $output = []; 70 $output[] = [ 71 '#markup' => '<p>' . $this->t("The following replacement tokens are available for this field.") . '</p>', 72 ]; 73 $items = []; 74 foreach ($variables as $key => $value) { 75 if (!empty($variables[$key])) { 76 $items[] = sprintf("{{ %s }} == %s", $key, $value); 77 } 78 } 79 $item_list = [ 80 '#theme' => 'item_list', 81 '#items' => $items, 82 ]; 83 $output[] = $item_list; 64 64 ]; 65 65 66 66 // @todo Show the available Twig variables / token browser. 67 if ($builder_definition = $form_state->getValue('builder_definition')) { 68 $variables = $builder_definition['variables']; 69 $output = []; 70 $output[] = [ 71 '#markup' => '<p>' . $this->t("The following replacement tokens are available for this field.") . '</p>', 72 ]; 73 $items = []; 74 foreach ($variables as $key => $value) { 75 if (!empty($variables[$key])) { 76 $items[] = sprintf("{{ %s }} == %s", $key, $value); 77 } 78 } 79 $item_list = [ 60 60 '#format' => $this->configuration['content']['format'] ?? filter_default_format(), 61 61 '#required' => TRUE, 62 62 '#rows' => 10, 63 63 '#description' => $this->t('Email body. This field may support tokens or Twig template syntax – please check the supplied default policy for possible values.'), 60 60 '#format' => $this->configuration['content']['format'] ?? filter_default_format(), 61 61 '#required' => TRUE, 62 62 '#rows' => 10, 63 63 '#description' => $this->t('Email body. This field may support tokens or Twig template syntax – please check the supplied default policy for possible values.'), 64 64 ]; 65 65 66 66 // @todo Show the available Twig variables / token browser. 67 if ($builder_definition = $form_state->getValue('builder_definition')) { 68 $variables = $builder_definition['variables']; 69 $output = []; 70 $output[] = [ 71 '#markup' => '<p>' . $this->t("The following replacement tokens are available for this field.") . '</p>', 17 17 * "mail" = @Translation("Message"), 18 18 * "copy" = @Translation("Sender copy"), 19 19 * }, 20 * override = {"contact.user_mail", "contact.user_copy"} 20 * override = {"contact.user_mail", "contact.user_copy"}, 21 * variables = { 22 * "recipient_name" = @Translation("Recipient name"), 23 * "recipient_edit_url" = @Translation("Recipient edit URL"), 24 * "subject" = @Translation("Subject"), 25 * "site_name" = @Translation("Site name"), 26 * "sender_name" = @Translation("Sender name"), 27 * "sender_url" = @Translation("Sender URL"), 35 35 * "default" = { "recipients" = "[site:mail]" }, 36 36 * "entity_sub_type" = "mail", 37 37 * }, 38 * }, 39 * variables = { 40 * "form" = @Translation("Form name"), 41 * "form_url" = @Translation("Form URL"), 42 * "subject" = @Translation("Subject"), 43 * "site_name" = @Translation("Site name"), 44 * "sender_name" = @Translation("Sender name"), 45 * "sender_url" = @Translation("Sender URL"),
Please register or sign in to reply