Projet

Général

Profil

Révision da542b7b

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.module
46 46
 * Implements hook_form_FORM_ID_alter().
47 47
 */
48 48
function media_wysiwyg_view_mode_form_media_wysiwyg_format_form_alter(&$form, $form_state) {
49
  // Find the current selected view mode.
49
  // Check to see if a view mode ("format") has already been specified for
50
  // this media item. First, check for a standard form-submitted value.
50 51
  if (!empty($form_state['values']['format'])) {
51 52
    $view_mode = $form_state['values']['format'];
52 53
  }
53
  else {
54
  // Second, check the request for a JSON-encoded value.
55
  elseif (isset($_GET['fields'])) {
56
    $query_fields = drupal_json_decode($_GET['fields']);
57
    if (isset($query_fields['format'])) {
58
      $view_mode = $query_fields['format'];
59
    }
60
  }
61
  // If we were unable to determine a view mode, or we found a view mode
62
  //  that does not exist in the list of format options presented on this
63
  //  form, use the default view mode.
64
  if (!isset($view_mode) || !array_key_exists($view_mode, $form['options']['format']['#options'])) {
54 65
    $view_mode = $form['options']['format']['#default_value'];
55 66
  }
56 67

  

Formats disponibles : Unified diff