The use of Select media can be, is for me, a bit confusing. Especially for already added media. Also, "Add" is used throughout Drupal in other places.

Current UI (with the edit patch):
Media widget current UI buttons
Proposed change:
Media widget new UI buttons

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Dave Reid’s picture

Status: Postponed » Active

I'm mostly in favor of this, although I think it would be good to rename 'Select' for a record that has an existing file to 'Replace'?

tsvenson’s picture

Yes, "Replace" is a better word than "Change" so +1 for that.

mpgeek’s picture

Changed the labels like so...
Select Media = Replace
Edit Media = Edit
Remove media = Remove
... and when there's no file yet for the element, you get Choose instead of "Replace". See screenshot, patch attached.

mpgeek’s picture

Status: Active » Needs review
mpgeek’s picture

After #1452832: What is the best way to modify the buttons in the media widget? and unstable6, the patch at #4 no longer applies. Here's another if you think simpler language is good for defaults. But as that issue points out, this is now easily overridden by well-placed alter hooks.

cecrs’s picture

Status: Needs review » Reviewed & tested by the community

Works beautifully, thanks! Just a general note, one-word buttons tend to work better in english anyway, in that the button text on smaller screens (or when the widget is placed inside a two column layout) doesn't wrap to two lines.

arthurf’s picture

Patch applies cleanly on 2.x, works as advertized

ParisLiakos’s picture

+++ b/media.moduleundefined
@@ -917,11 +917,13 @@ function media_element_process(&$element, &$form_state, $form) {
-    '#title' => t('Select media'),
+    '#title' => $file ? t('Replace') : t('Choose'),

Maybe Add is better than Choose?

arthurf’s picture

That should probably be ! empty($file) ? t('Replace') : t('Choose') to not throw a php warning

ParisLiakos’s picture

$file is always set (see here)
$file = $fid ? file_load($fid) : FALSE;

arthurf’s picture

Woops, sorry, only read the patch there. We can probably change this line then:


  $element['preview'] = array(
    '#prefix' => '<div class="preview launcher">', 
    '#suffix' => '</div>', 
    '#weight' => 0, 
    'content' => !empty($file) ? media_get_thumbnail_preview($file) : array(),
  );

obviously not necessary but keeps things a bit neater.

ParisLiakos’s picture

Status: Reviewed & tested by the community » Needs work

i seriously dont like choose..select or add is far more better

arthurf’s picture

I agree with rootatwc on select. We should also pay attention to this issue as well: http://drupal.org/node/1807832

tsvenson’s picture

Just want to tune in to the chorus in #13 and #14 and say that "Add" is the preferred for me to. "Choose" doesn't work as there is nothing visible for the user to select from.

arthurf’s picture

FileSize
1.63 KB

Rerolled patch with request from rootatwc

arthurf’s picture

Status: Needs work » Needs review

Setting correct status

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for rerolling this arthur..
i think its ready now

ParisLiakos’s picture

Status: Reviewed & tested by the community » Fixed

commited
http://drupalcode.org/project/media.git/commit/06d0a36

Thanks

Given that this change will break translations, do we want to backport it?

Rob C’s picture

1 thing i did just notice is the 'add' button changed somewhere, but not sure if that's related / where it was 'introduced':

  • Add content type + file / media selector.
  • Add a node with an image and save the node.
  • Then edit the node, hit the 'Remove' button next to the media.

The 'Add' button now reads 'Replace'. Just a minor thing.

Dave Reid’s picture

Status: Fixed » Needs work

Yeah this is why keeping 'Select' would have been nice. If we have Add vs Replace you have two swap out the text using JavaScript. Swapping it out via JavaScript means that you are no longer able to override the button text since the strings are hard-coded in the JS, or you'd need to provide the text in a data attribute of the button, which at that point seems like we're just adding unnecessary complexity.

ParisLiakos’s picture

Status: Needs work » Needs review
FileSize
507 bytes

agreed

arthurf’s picture

Works as advertised, looks good to me!

ParisLiakos’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Missed a g for the file