Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
drupal
Merge requests
!3924
Alter media before rendering
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Alter media before rendering
issue/drupal-3132324:3132324-alter-embed-media
into
10.1.x
Overview
0
Commits
2
Pipelines
0
Changes
2
Open
Claudiu Cristea
requested to merge
issue/drupal-3132324:3132324-alter-embed-media
into
10.1.x
2 years ago
Overview
0
Commits
2
Pipelines
0
Changes
2
Expand
Closes
#3132324
0
0
Merge request reports
Compare
10.1.x
version 1
f90b54d7
2 years ago
10.1.x (HEAD)
and
latest version
latest version
3205695d
2 commits,
2 years ago
version 1
f90b54d7
1 commit,
2 years ago
2 files
+
70
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
core/modules/media/src/Event/MediaPreEmbedEvent.php
0 → 100644
+
56
−
0
Options
<?php
namespace
Drupal\media\Event
;
use
Drupal\media\MediaInterface
;
use
Symfony\Contracts\EventDispatcher\Event
;
/**
* Event dispatched before a media entity is rendered to be embedded.
*
* Subscribers can alter the media entity passed to this event to customize the
* way the embed entity is rendered. This is safe as the entity is a clone and
* the original media entity will not be changed. For instance, one subscriber
* can read a 'data-*' attribute from the $node element and apply certain
* changes to $media, allowing a per-embed instance customization.
*
* @see \Drupal\media\Plugin\Filter\MediaEmbed::process()
* @see \Drupal\media\Plugin\Filter\MediaEmbed::applyPerEmbedMediaOverrides()
*/
class
MediaPreEmbedEvent
extends
Event
{
/**
* Constructs a new even instance.
*
* @param \DOMElement $node
* The DOM element node.
* @param \Drupal\media\MediaInterface $media
* The embed media entity.
*/
public
function
__construct
(
protected
\DOMElement
$node
,
protected
MediaInterface
$media
)
{
}
/**
* Returns the DOM element node.
*
* @return \DOMElement
* The DOM element node.
*/
public
function
getNode
():
\DOMElement
{
return
$this
->
node
;
}
/**
* Returns the embed media entity.
*
* @return \Drupal\media\MediaInterface
* The embed media entity.
*/
public
function
getMedia
():
MediaInterface
{
return
$this
->
media
;
}
}
Loading