I am using Media 2.0 and a media field in a custom admin form.

I am trying to set the default value as described on https://www.drupal.org/project/media/issues/1158760#comment-12656764, but `#default_value = array('fid' => 1234); doesn't work.

How can I set the default value for a Media form element?

1 Answer 1


After some digging in the media module, this is the working notation:

'#default_value' => 12345,

Plain and simple...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.