Projet

Général

Profil

Révision ca0757b9

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media/media.api.php
102 102
  $stored_params['types'][] = 'document';
103 103
  unset($stored_params['enabledPlugins'][0]);
104 104
}
105

  
106
/**
107
 * Alter a list of view modes allowed for a file embedded in the WYSIWYG.
108
 *
109
 * @param array $view_modes
110
 *   An array of view modes that can be used on the file when embedded in the
111
 *   WYSIWYG.
112
 * @param object $file
113
 *   A file entity.
114
 *
115
 * @see media_get_wysiwyg_allowed_view_modes()
116
 */
117
function hook_media_wysiwyg_allowed_view_modes_alter(&$view_modes, $file) {
118
  $view_modes['default']['label'] = t('Display an unmodified version of the file');
119
  unset($view_modes['preview']);
120
}
121

  
122
/**
123
 * Alter the WYSIWYG view mode selection form.
124
 *
125
 * Similar to a form_alter, but runs first so that modules can add
126
 * fields specific to a given file type (like alt tags on images) before alters
127
 * begin to work on the fields.
128
 *
129
 * @param array $form
130
 *   An associative array containing the structure of the form.
131
 * @param array $form_state
132
 *   An associative array containing the current state of the form.
133
 * @param object $file
134
 *   A file entity.
135
 *
136
 * @see media_format_form()
137
 */
138
function hook_media_format_form_prepare_alter(&$form, &$form_state, $file) {
139
  $form['preview']['#access'] = FALSE;
140

  
141
  $file = $form['#media'];
142
  $form['heading']['#markup'] = t('Embedding %filename of type %filetype', array('%filename' => $file->filename, '%filetype' => $file->type));
143
}
144

  
145
/**
146
 * Alter the output generated by Media filter tags.
147
 *
148
 * @param array $element
149
 *   The renderable array of output generated for the filter tag.
150
 * @param array $tag_info
151
 *   The filter tag converted into an associative array by
152
 *   media_token_to_markup() with the following elements:
153
 *   - 'fid': The ID of the media file being rendered.
154
 *   - 'file': The object from file_load() of the media file being rendered.
155
 *   - 'view_mode': The view mode being used to render the file.
156
 *   - 'attributes': An additional array of attributes that could be output
157
 *     with media_get_file_without_label().
158
 * @param array $settings
159
 *   An additional array of settings.
160
 *   - 'wysiwyg': A boolean if the output is for the WYSIWYG preview or FALSE
161
 *     if for normal rendering.
162
 *
163
 * @see media_token_to_markup()
164
 */
165
function hook_media_token_to_markup_alter(&$element, $tag_info, $settings) {
166
  if (empty($settings['wysiwyg'])) {
167
    $element['#attributes']['alt'] = t('This media has been output using the @mode view mode.', array('@mode' => $tag_info['view_mode']));
168
  }
169
}

Formats disponibles : Unified diff