Skip to content
Snippets Groups Projects

Issue #3404625: Added display of TWIG variables in the BodyEmailAdjuster.

Open Issue #3404625: Added display of TWIG variables in the BodyEmailAdjuster.

Merge request reports

Members who can merge are allowed to add commits.

Merge request pipeline passed with warnings for b3e4daeb

Code Quality is loading
Test summary results are being parsed
Ready to merge by members who can write to the target branch.
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Adam Shepherd
  • Adam Shepherd
  • Adam Shepherd
  • Vlad Denysiuk added 1 commit

    added 1 commit

    • b3e4daeb - Issue #3404625: Added changes based on comments in MR and added a deprecated...

    Compare with previous version

  • Adam Shepherd resolved all threads

    resolved all threads

  • 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.
  • 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;
    • Currently there are three assignments $output =

      I think better like this:

      $output = [
        '#markup' => '<p>' . $this->t("The following replacement tokens are available for this field.") . '</p>',
        $item_list,
      ];
    • Please register or sign in to reply
  • 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 = [
  • 64 64 ];
    65 65
    66 66 // @todo Show the available Twig variables / token browser.
    67 if ($builder_definition = $form_state->getValue('builder_definition')) {
  • 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>',
  • 36 36 * "entity_sub_type" = "receipt",
    37 37 * },
    38 38 * },
    39 * variables = {
    40 * "order_number" = @Translation("Order number"),
    41 * "store" = @Translation("Store name"),
  • 33 33 * "entity_sub_type" = "node",
    34 34 * },
    35 35 * },
    36 * variables = {
    37 * "opt_out_hidden" = @Translation("Opt-out hidden"),
    38 * "test" = @Translation("Is test email"),
  • 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
    Loading