Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
custom_elements-3445190
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
custom_elements-3445190
Commits
28e51db6
Commit
28e51db6
authored
5 years ago
by
Alen Pagac
Browse files
Options
Downloads
Patches
Plain Diff
#3065666
: Fixed video PG processor to enable class inheriting.
parent
997e862f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/custom_elements_thunder/src/Processor/ParagraphVideoProcessor.php
+11
-4
11 additions, 4 deletions
...lements_thunder/src/Processor/ParagraphVideoProcessor.php
with
11 additions
and
4 deletions
modules/custom_elements_thunder/src/Processor/ParagraphVideoProcessor.php
+
11
−
4
View file @
28e51db6
...
...
@@ -20,6 +20,13 @@ class ParagraphVideoProcessor implements CustomElementProcessorInterface {
*/
protected
$providerManager
;
/**
* Video embed provider.
*
* @var \Drupal\media\OEmbed\Provider $provider
*/
protected
$provider
;
/**
* Constructs the renderer.
*
...
...
@@ -56,11 +63,11 @@ class ParagraphVideoProcessor implements CustomElementProcessorInterface {
/** @var \Drupal\media_entity\Entity\Media $media_entity */
$media_entity
=
$paragraph
->
field_video
->
entity
;
$provider
=
$this
->
providerManager
->
loadProviderFromInput
(
$media_entity
->
field_media_video_embed_field
->
value
);
if
(
!
$provider
)
{
$
this
->
provider
=
$this
->
providerManager
->
loadProviderFromInput
(
$media_entity
->
field_media_video_embed_field
->
value
);
if
(
!
$
this
->
provider
)
{
return
;
}
$embed_code
=
$provider
->
renderEmbedCode
(
'0'
,
'0'
,
FALSE
);
$embed_code
=
$
this
->
provider
->
renderEmbedCode
(
'0'
,
'0'
,
FALSE
);
$video_element
=
new
CustomElement
();
$video_element
->
addCacheableDependency
(
$media_entity
);
...
...
@@ -68,7 +75,7 @@ class ParagraphVideoProcessor implements CustomElementProcessorInterface {
$video_element
->
setAttributes
([
'src'
=>
$embed_code
[
'#url'
]]);
$element
->
setSlotFromCustomElement
(
'video'
,
$video_element
);
$element
->
setSlot
(
'thumbnail'
,
''
,
'img'
,
[
'src'
=>
$provider
->
getRemoteThumbnailUrl
()]);
$element
->
setSlot
(
'thumbnail'
,
''
,
'img'
,
[
'src'
=>
$
this
->
provider
->
getRemoteThumbnailUrl
()]);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment