Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This project is not covered by Drupal’s security advisory policy.
The tiny module provides the ability to edit a Media entity in a modal window.
Also added edit this media button to EditorMediaDialog form that is used in the CKEditor embed media plugin.
Installation
Install as usual.
composer require drupal/edit_media_modal
drush en edit_media_modal
Video example
Usage
As default module provides an edit media link for the EditorMediaDialog. But You will be able to use this improvement in the many places where do you need that.
$form['edit_media_link'] = $media->toLink($this->t('Edit this media'), 'edit-form', [
'query' => [
'edit_media_in_modal' => TRUE, // Add that to have ajax actions for the media edit form.
'destination' => \Drupal\Core\Url::fromRoute('<front>')->toString(), // Add that if you need redirect somewhere after submitting.
],
])->toRenderable();
$form['edit_media_link']['#attributes'] = [
'class' => [
'js-media-library-edit-modal-link',
'media-library-edit__modal-link',
'use-ajax',
'button',
],
'target' => '_self',
'data-dialog-options' => json_encode([
'height' => '75%',
'width' => '75%',
'classes' => [
'ui-dialog-content' => 'media-library-edit__modal-link',
],
]),
'data-dialog-type' => 'modal',
];
Supporting organizations:
Module Development and Maintenance
Project information
- Module categories: Content Editing Experience, Media
- Ecosystem: Drupal Media
- 471 sites report using this module
- Created by blade_ukraine on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
Releases
1.0.2
released 17 December 2022
Works with Drupal: ^8.8.0 || ^9.0 || ^10.0
✓ Recommended by the project’s maintainer.
Install: