diff --git a/modules/media_internet/media_internet.module b/modules/media_internet/media_internet.module index e785037..2905ec3 100644 --- a/modules/media_internet/media_internet.module +++ b/modules/media_internet/media_internet.module @@ -52,10 +52,22 @@ function media_internet_permission() { * @todo Convert the form arguments to just one array of options/parameters. */ function media_internet_add($form, &$form_state = array(), $types = NULL) { + $providers = array(); + foreach (media_internet_get_providers() as $key => $provider) { + if (empty($provider['hidden']) || $provider['hidden'] != TRUE) { + // @todo Convert this to show provider images in a nice format. + $class = drupal_clean_css_identifier(drupal_strtolower($provider['title'])); + $providers[] = array( + 'data' => check_plain($provider['title']), + 'class' => array($class), + ); + } + } + $form['embed_code'] = array( '#type' => 'textfield', - '#title' => t('URL or Embed code'), - '#description' => t('Input a url or embed code from one of the listed providers.'), + '#title' => t('Enter a URL to an image'), + '#description' => t('Enter a URL to an image on the web.'), '#attributes' => array('class' => array('media-add-from-url')), // There is no standard specifying a maximum length for a URL. Internet // Explorer supports upto 2083 (http://support.microsoft.com/kb/208427), so @@ -64,41 +76,26 @@ function media_internet_add($form, &$form_state = array(), $types = NULL) { '#required' => TRUE, ); - - // @todo: - // Add live previews back (currently broken) - - //$form['preview'] = array( - // '#type' => 'item', - // '#title' => t('Preview'), - // '#markup' => '
' - //); + // If any providers are enabled it is assumed that some kind of embed is supported + if ($providers) { + $form['embed_code']['#title'] = t('Enter an image URL or an embed code'); + $form['embed_code']['#description'] = t('Enter a URL or the embed code from a media provider.'); + + $form['providers'] = array( + '#theme' => 'item_list', + '#title' => t('Supported providers'), + '#items' => $providers, + '#attributes' => array( + 'class' => array('media-internet-providers'), + ), + ); + } $form['#validators'] = array(); if ($types) { $form['#validators']['media_file_validate_types'] = array($types); } - $providers = array(); - foreach (media_internet_get_providers() as $key => $provider) { - if (empty($provider['hidden']) || $provider['hidden'] != TRUE) { - // @todo Convert this to show provider images in a nice format. - $class = drupal_clean_css_identifier(drupal_strtolower($provider['title'])); - $providers[] = array( - 'data' => check_plain($provider['title']), - 'class' => array($class), - ); - } - } - $form['providers'] = array( - '#theme' => 'item_list', - '#title' => t('Supported providers'), - '#items' => $providers, - '#attributes' => array( - 'class' => array('media-internet-providers'), - ), - ); - $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit',