Skip to content

Instantly share code, notes, and snippets.

@ahebrank
Created January 28, 2024 20:30
Show Gist options
  • Save ahebrank/2a4e87270487a23fee4d3059f82536b0 to your computer and use it in GitHub Desktop.
Save ahebrank/2a4e87270487a23fee4d3059f82536b0 to your computer and use it in GitHub Desktop.
diff --git a/css/media_library_edit.admin.css b/css/media_library_edit.admin.css
index 0a163d4..5a5ec48 100644
--- a/css/media_library_edit.admin.css
+++ b/css/media_library_edit.admin.css
@@ -8,7 +8,6 @@
margin: 5px;
padding: 0;
transition: 0.2s border-color;
- color: transparent;
border: 2px solid #ccc;
border-radius: 20px;
background: url(../icons/pencil.svg) #fff center no-repeat;
@@ -17,10 +16,6 @@
box-sizing: border-box;
}
-.media-library-edit__link:hover {
- color: transparent;
-}
-
.media-library-edit__modal::before {
content: '';
width: 100vw;
diff --git a/media_library_edit.module b/media_library_edit.module
index cbd818c..a2cee5e 100644
--- a/media_library_edit.module
+++ b/media_library_edit.module
@@ -14,10 +14,10 @@ use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\WidgetInterface;
use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Render\Element;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Drupal\media_library\MediaLibraryUiBuilder;
+use Drupal\Component\Render\FormattableMarkup;
/**
* Implements hook_help().
@@ -99,7 +99,9 @@ function media_library_edit_field_widget_single_element_form_alter(array &$eleme
$dialog_options = MediaLibraryUiBuilder::dialogOptions();
$element['selection'][$key]['media_edit'] = [
'#type' => 'link',
- '#title' => t('Edit media item'),
+ '#title' => new FormattableMarkup('<span class="visually-hidden">@link_text</span>', [
+ '@link_text' => t('Edit media item'),
+ ]),
'#url' => $edit_url,
'#attributes' => [
'class' => [
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment