Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
soundcloudfield
Commits
32117f27
Commit
32117f27
authored
Oct 15, 2021
by
cburschka
Committed by
akoepke
Oct 15, 2021
Browse files
Issue
#2859284
by cburschka: Let the Link formatter print an unstyled URL
parent
e6456b6f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/Plugin/Field/FieldFormatter/SoundCloudURLFormatter.php
View file @
32117f27
...
...
@@ -6,6 +6,7 @@ use Drupal\Component\Utility\Unicode;
use
Drupal\Core\Field\FieldItemListInterface
;
use
Drupal\Core\Field\FormatterBase
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Url
;
/**
* Plugin implementation of the 'soundcloud_url' formatter.
...
...
@@ -25,11 +26,11 @@ class SoundCloudURLFormatter extends FormatterBase {
* {@inheritdoc}
*/
public
function
viewElements
(
FieldItemListInterface
$items
,
$langcode
)
{
$elements
=
array
()
;
$elements
=
[]
;
foreach
(
$items
as
$delta
=>
$item
)
{
if
(
!
$item
->
isEmpty
())
{
$elements
[
$delta
][
'#markup'
]
=
$item
->
url
;
$elements
[
$delta
][
'#markup'
]
=
Url
::
fromUri
(
$item
->
url
)
->
toString
()
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment