Loading src/Plugin/Field/FieldFormatter/LinkDescriptionFormatter.php +9 −2 Original line number Diff line number Diff line Loading @@ -30,9 +30,16 @@ class LinkDescriptionFormatter extends LinkFormatter { $elements[$delta] = [ '#theme' => 'link_with_description', '#link' => $link, '#description' => $item->description, ]; if ($item->description) { // The description value has no text format assigned to it, so the user // input should equal the output, including newlines. $elements[$delta]['#description'] = [ '#type' => 'inline_template', '#template' => '{{ value|nl2br }}', '#context' => ['value' => $item->description], ]; } } return $elements; } Loading src/Plugin/Field/FieldFormatter/LinkSeparateDescriptionFormatter.php +9 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,15 @@ class LinkSeparateDescriptionFormatter extends LinkSeparateFormatter { foreach ($items as $delta => $item) { // Alter formatter by displaying the additional description via template. $elements[$delta]['#theme'] = 'link_with_description_separate_text_url'; $elements[$delta]['#description'] = $item->description; if ($item->description) { // The description value has no text format assigned to it, so the user // input should equal the output, including newlines. $elements[$delta]['#description'] = [ '#type' => 'inline_template', '#template' => '{{ value|nl2br }}', '#context' => ['value' => $item->description], ]; } } return $elements; } Loading Loading
src/Plugin/Field/FieldFormatter/LinkDescriptionFormatter.php +9 −2 Original line number Diff line number Diff line Loading @@ -30,9 +30,16 @@ class LinkDescriptionFormatter extends LinkFormatter { $elements[$delta] = [ '#theme' => 'link_with_description', '#link' => $link, '#description' => $item->description, ]; if ($item->description) { // The description value has no text format assigned to it, so the user // input should equal the output, including newlines. $elements[$delta]['#description'] = [ '#type' => 'inline_template', '#template' => '{{ value|nl2br }}', '#context' => ['value' => $item->description], ]; } } return $elements; } Loading
src/Plugin/Field/FieldFormatter/LinkSeparateDescriptionFormatter.php +9 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,15 @@ class LinkSeparateDescriptionFormatter extends LinkSeparateFormatter { foreach ($items as $delta => $item) { // Alter formatter by displaying the additional description via template. $elements[$delta]['#theme'] = 'link_with_description_separate_text_url'; $elements[$delta]['#description'] = $item->description; if ($item->description) { // The description value has no text format assigned to it, so the user // input should equal the output, including newlines. $elements[$delta]['#description'] = [ '#type' => 'inline_template', '#template' => '{{ value|nl2br }}', '#context' => ['value' => $item->description], ]; } } return $elements; } Loading