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.
Problem/Motivation
I want to add a media field to a form. I use the following snippet:
$form['image'] = array(
'#type' => 'media',
'#tree' => TRUE,
'#title' => t('Image'),
'#description' => '',
'#input' => TRUE,
'#media_options' => array(
'global' => array(
'types' => array('image'),
),
),
);
In 2.x-alpha it works fine. I get the media widget and can attache images with the media browser.
But in 2.0-beta1 it doesn't work anymore. I get only the non JS fallback:
I know, there are API changes but I can't find a solution.
Comment | File | Size | Author |
---|---|---|---|
media_fallback.JPG | 9.59 KB | J-Lee |
Comments
Comment #2
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedClosing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team