Révision d1c64ea8
Ajouté par Assos Assos il y a plus de 6 ans
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.pages.inc | ||
---|---|---|
80 | 80 |
'#default_value' => $default_view_mode, |
81 | 81 |
'#description' => t('Choose the type of display you would like for this |
82 | 82 |
file. Please be aware that files may display differently than they do when |
83 |
they are inserted into an editor.') |
|
83 |
they are inserted into an editor.'),
|
|
84 | 84 |
); |
85 | 85 |
|
86 | 86 |
// If necessary, display the alignment widget. |
... | ... | |
112 | 112 |
// Get the external url from the fid array. |
113 | 113 |
$external_url = empty($query_fields['external_url']) ? NULL : $query_fields['external_url']; |
114 | 114 |
// Field to attach external url's to files for linking. |
115 |
if(variable_get('media_wysiwyg_external_link', FALSE)) { |
|
116 |
if($file->type == 'image') { |
|
115 |
if (variable_get('media_wysiwyg_external_link', FALSE)) {
|
|
116 |
if ($file->type == 'image') {
|
|
117 | 117 |
$form['options']['external_url'] = array( |
118 | 118 |
'#type' => 'textfield', |
119 | 119 |
'#title' => t('Link Image'), |
... | ... | |
155 | 155 |
/** |
156 | 156 |
* Add ajax preview when selecting view mode in wysiwyg editor. |
157 | 157 |
*/ |
158 |
function media_wysiwyg_format_form_view_mode(&$form, $form_state, $file) {
|
|
158 |
function media_wysiwyg_format_form_view_mode(&$form, $form_state, $file) { |
|
159 | 159 |
// Check to see if a view mode ("format") has already been specified for |
160 |
// this media item. First, check for a standard form-submitted value.
|
|
160 |
// this media item. First, check for a standard form-submitted value. |
|
161 | 161 |
if (!empty($form_state['values']['format'])) { |
162 | 162 |
$view_mode = $form_state['values']['format']; |
163 | 163 |
} |
... | ... | |
169 | 169 |
} |
170 | 170 |
} |
171 | 171 |
// If we were unable to determine a view mode, or we found a view mode |
172 |
// that does not exist in the list of format options presented on this
|
|
173 |
// form, use the default view mode.
|
|
172 |
// that does not exist in the list of format options presented on this |
|
173 |
// form, use the default view mode. |
|
174 | 174 |
if (!isset($view_mode) || !array_key_exists($view_mode, $form['options']['format']['#options'])) { |
175 | 175 |
$view_mode = variable_get('media_wysiwyg_wysiwyg_default_view_mode', 'full'); |
176 | 176 |
} |
177 | 177 |
|
178 |
$link_options = array( |
|
179 |
'attributes' => array( |
|
180 |
'class' => 'button', |
|
181 |
'title' => t('Use for replace fox or edit file fields.'), |
|
182 |
), |
|
183 |
); |
|
184 |
if (!empty($_GET['render'])) { |
|
185 |
$link_options['query']['render'] = $_GET['render']; |
|
186 |
} |
|
187 |
|
|
178 | 188 |
$form['preview'] = array(); |
179 | 189 |
$form['preview']['#prefix'] = '<div class="media-preview-group"><div class="media-item"><div class="media-thumbnail">'; |
180 |
$form['preview']['#suffix'] = '</div><div class="label-wrapper"><label class="media-filename">' . check_plain($file->filename) . '</label></div></div><div class="edit-file-link">' . l(t('Edit file'), 'file/'.$file->fid.'/edit', array('attributes' => array('class' => 'button', 'title' => t('Use for replace file or edit file fields.')))) . '</div></div>';
|
|
190 |
$form['preview']['#suffix'] = '</div><div class="label-wrapper"><label class="media-filename">' . check_plain($file->filename) . '</label></div></div><div class="edit-file-link">' . l(t('Edit file'), 'file/' . $file->fid . '/edit', $link_options) . '</div></div>';
|
|
181 | 191 |
$form['preview']['thumbnail'] = file_view_file($file, $view_mode); |
182 | 192 |
$form['preview']['thumbnail']['#prefix'] = '<div id="media-preview">'; |
183 | 193 |
$form['preview']['thumbnail']['#suffix'] = '</div>'; |
... | ... | |
212 | 222 |
} |
213 | 223 |
|
214 | 224 |
/** |
215 |
* AJAX callback to select the portion of the format form to be updated with a preview.
|
|
225 |
* AJAX callback to select portion of format form to be updated with a preview.
|
|
216 | 226 |
* |
217 | 227 |
* @param array $form |
218 | 228 |
* An associative array containing the structure of the form. |
Formats disponibles : Unified diff
Weekly update of contrib modules