Révision 9a28ac3f
Ajouté par Assos Assos il y a presque 4 ans
drupal7/sites/all/modules/file_entity/file_entity.admin.inc | ||
---|---|---|
1112 | 1112 |
'#maxlength' => NULL, |
1113 | 1113 |
); |
1114 | 1114 |
|
1115 |
$form['file_entity_max_filesize_extensions'] = array( |
|
1116 |
'#type' => 'textarea', |
|
1117 |
'#title' => t('Maximum upload size per extension'), |
|
1118 |
'#default_value' => variable_get('file_entity_max_filesize_extensions', ''), |
|
1119 |
'#description' => t('Set the maximum filesize for specific extensions. Enter one value per line, in the format <strong>extension|filesize</strong>. When an extension does not have a file size limit, the default maximum file size is used.'), |
|
1120 |
'#rows' => 10, |
|
1121 |
'#element_validate' => array('file_entity_max_filesize_extensions_validate'), |
|
1122 |
); |
|
1123 |
|
|
1115 | 1124 |
$form['file_entity_alt'] = array( |
1116 | 1125 |
'#type' => 'textfield', |
1117 | 1126 |
'#title' => t('Alt attribute'), |
... | ... | |
1183 | 1192 |
|
1184 | 1193 |
return system_settings_form($form); |
1185 | 1194 |
} |
1195 |
|
|
1196 |
/** |
|
1197 |
* Element validate callback for the maximum upload size / file extension field. |
|
1198 |
*/ |
|
1199 |
function file_entity_max_filesize_extensions_validate($element, &$form_state) { |
|
1200 |
$list = explode("\n", $element['#value']); |
|
1201 |
|
|
1202 |
foreach ($list as $position => $text) { |
|
1203 |
$matches = array(); |
|
1204 |
preg_match('/(.*)\|(.*)/', $text, $matches); |
|
1205 |
|
|
1206 |
$extension = $matches[1]; |
|
1207 |
$filesize = $matches[2]; |
|
1208 |
|
|
1209 |
//Validate filesize. |
|
1210 |
$element['#value'] = $filesize; |
|
1211 |
_file_generic_settings_max_filesize($element, $form_state); |
|
1212 |
|
|
1213 |
//Validate extension. |
|
1214 |
$extensions = explode(' ', $form_state['input']['file_entity_default_allowed_extensions']); |
|
1215 |
if (!in_array($extension, $extensions)) { |
|
1216 |
form_error($element, t('"!extension" was not found in the list of allowed extensions.', array('!extension' => $extension))); |
|
1217 |
} |
|
1218 |
} |
|
1219 |
} |
drupal7/sites/all/modules/file_entity/file_entity.file.inc | ||
---|---|---|
130 | 130 |
* Returns whether the file has changed |
131 | 131 |
*/ |
132 | 132 |
function file_entity_has_file_changed($file) { |
133 |
return empty($file->is_new) || empty($file->original) || $file->filesize != $file->original->filesize || $file->uri != $file->original->uri;
|
|
133 |
return empty($file->is_new) ? empty($file->original) || $file->filesize != $file->original->filesize || $file->uri != $file->original->uri : FALSE;
|
|
134 | 134 |
} |
135 | 135 |
|
136 | 136 |
|
... | ... | |
275 | 275 |
if (!isset($language)) { |
276 | 276 |
$language = $GLOBALS['language']; |
277 | 277 |
} |
278 |
|
|
279 |
$alt = variable_get('file_entity_alt', '[file:field_file_image_alt_text]'); |
|
280 |
$title = variable_get('file_entity_title', '[file:field_file_image_title_text]'); |
|
281 |
|
|
282 | 278 |
$replace_options = array( |
283 | 279 |
'clear' => TRUE, |
284 | 280 |
'sanitize' => FALSE, |
... | ... | |
286 | 282 |
); |
287 | 283 |
|
288 | 284 |
foreach ($files as $file) { |
289 |
// Load alt and title text from fields. |
|
290 |
if (!empty($alt)) { |
|
291 |
$output = token_replace($alt, array('file' => $file), $replace_options); |
|
292 |
|
|
293 |
if (!empty($output)) { |
|
294 |
// @todo Remove once https://www.drupal.org/node/1713164 is fixed. |
|
295 |
// There is currently no way to get the raw alt text returned from the |
|
296 |
// token so we revert the encoding done during tokenization. |
|
297 |
$file->alt = decode_entities($output); |
|
298 |
} |
|
299 |
} |
|
300 |
if (!empty($title)) { |
|
301 |
$output = token_replace($title, array('file' => $file), $replace_options); |
|
302 |
|
|
303 |
if (!empty($output)) { |
|
304 |
// @todo Remove once https://www.drupal.org/node/1713164 is fixed. |
|
305 |
// There is currently no way to get the raw title text returned from the |
|
306 |
// token so we revert the encoding done during tokenization. |
|
307 |
$file->title = decode_entities($output); |
|
308 |
} |
|
309 |
} |
|
285 |
$file->title = file_entity_replace_title($file, $replace_options, NULL, $language->language); |
|
286 |
$file->alt = file_entity_replace_alt($file, $replace_options, NULL, $language->language); |
|
310 | 287 |
} |
311 | 288 |
} |
312 | 289 |
|
drupal7/sites/all/modules/file_entity/file_entity.info | ||
---|---|---|
32 | 32 |
; We have to add a fake version so Git checkouts do not fail Media dependencies |
33 | 33 |
version = 7.x-2.x-dev |
34 | 34 |
|
35 |
; Information added by Drupal.org packaging script on 2019-11-20
|
|
36 |
version = "7.x-2.27"
|
|
35 |
; Information added by Drupal.org packaging script on 2020-06-01
|
|
36 |
version = "7.x-2.28"
|
|
37 | 37 |
core = "7.x" |
38 | 38 |
project = "file_entity" |
39 |
datestamp = "1574278088" |
|
39 |
datestamp = "1591051455" |
drupal7/sites/all/modules/file_entity/file_entity.module | ||
---|---|---|
1250 | 1250 |
} |
1251 | 1251 |
} |
1252 | 1252 |
|
1253 |
/** |
|
1254 |
* Replace file entity title text. |
|
1255 |
* |
|
1256 |
* @param $file |
|
1257 |
* The file entity. |
|
1258 |
* @param $replace_options |
|
1259 |
* (Optional) Options to pass to token_replace(). |
|
1260 |
* @param $title |
|
1261 |
* (Optional) The title text to use. |
|
1262 |
* @param string $langcode |
|
1263 |
* (Optional) Language code |
|
1264 |
* |
|
1265 |
* @return string |
|
1266 |
* Returns the replaced title text. |
|
1267 |
*/ |
|
1268 |
function file_entity_replace_title($file, $replace_options = [], $title = NULL, $langcode = NULL) { |
|
1269 |
$replace_options += [ |
|
1270 |
'clear' => TRUE, |
|
1271 |
'sanitize' => FALSE, |
|
1272 |
]; |
|
1273 |
|
|
1274 |
$title_default = '[file:field_file_image_title_text]'; |
|
1275 |
if (!isset($title)) { |
|
1276 |
$title = variable_get('file_entity_title', $title_default); |
|
1277 |
} |
|
1278 |
// If the defaults are not changed then inlining replacement is much faster |
|
1279 |
// than dealing with the token system. |
|
1280 |
if ($title === $title_default) { |
|
1281 |
$title_items = field_get_items('file', $file, 'field_file_image_title_text', $langcode); |
|
1282 |
return $title_items ? $title_items[0]['value'] : ''; |
|
1283 |
} |
|
1284 |
elseif (!empty($title)) { |
|
1285 |
$token_replaced = token_replace($title, ['file' => $file], $replace_options); |
|
1286 |
return decode_entities($token_replaced); // Filter out possible XSS. |
|
1287 |
} |
|
1288 |
|
|
1289 |
return ''; |
|
1290 |
} |
|
1291 |
|
|
1292 |
/** |
|
1293 |
* Replace file entity alt. |
|
1294 |
* |
|
1295 |
* @param $file |
|
1296 |
* The file entity. |
|
1297 |
* @param array $replace_options |
|
1298 |
* (Optional) Options to pass to token_replace(). |
|
1299 |
* @param $alt |
|
1300 |
* (Optional) The alt text to use. |
|
1301 |
* @param string $langcode |
|
1302 |
* (Optional) Language code |
|
1303 |
* |
|
1304 |
* @return string |
|
1305 |
* Returns the replaced alt text. |
|
1306 |
*/ |
|
1307 |
function file_entity_replace_alt($file, $replace_options = [], $alt = NULL, $langcode = NULL) { |
|
1308 |
$replace_options += [ |
|
1309 |
'clear' => TRUE, |
|
1310 |
'sanitize' => FALSE, |
|
1311 |
]; |
|
1312 |
|
|
1313 |
$alt_default = '[file:field_file_image_alt_text]'; |
|
1314 |
|
|
1315 |
if (!isset($alt)) { |
|
1316 |
$alt = variable_get('file_entity_alt', $alt_default); |
|
1317 |
} |
|
1318 |
|
|
1319 |
// If the defaults are not changed then inlining replacement is much faster |
|
1320 |
// than dealing with the token system. |
|
1321 |
if ($alt === $alt_default) { |
|
1322 |
$alt_items = field_get_items('file', $file, 'field_file_image_alt_text', $langcode); |
|
1323 |
return $alt_items ? $alt_items[0]['value'] : ''; |
|
1324 |
} |
|
1325 |
elseif (!empty($alt)) { |
|
1326 |
$token_replaced = token_replace($alt, ['file' => $file], $replace_options); |
|
1327 |
return decode_entities($token_replaced); // Filter out possible XSS. |
|
1328 |
} |
|
1329 |
|
|
1330 |
return ''; |
|
1331 |
} |
|
1332 |
|
|
1253 | 1333 |
/** |
1254 | 1334 |
* Implements hook_file_formatter_FORMATTER_view(). |
1255 | 1335 |
* |
... | ... | |
1290 | 1370 |
'#path' => $file->uri, |
1291 | 1371 |
'#width' => isset($file->override['attributes']['width']) ? $file->override['attributes']['width'] : $file->metadata['width'], |
1292 | 1372 |
'#height' => isset($file->override['attributes']['height']) ? $file->override['attributes']['height'] : $file->metadata['height'], |
1293 |
'#alt' => token_replace($display['settings']['alt'], array('file' => $file), $replace_options),
|
|
1294 |
'#title' => token_replace($display['settings']['title'], array('file' => $file), $replace_options),
|
|
1373 |
'#alt' => file_entity_replace_alt($file, $replace_options, $display['settings']['alt'], $langcode),
|
|
1374 |
'#title' => file_entity_replace_title($file, $replace_options, $display['settings']['title'], $langcode),
|
|
1295 | 1375 |
); |
1296 | 1376 |
} |
1297 | 1377 |
else { |
... | ... | |
1300 | 1380 |
'#path' => $file->uri, |
1301 | 1381 |
'#width' => isset($file->override['attributes']['width']) ? $file->override['attributes']['width'] : $file->metadata['width'], |
1302 | 1382 |
'#height' => isset($file->override['attributes']['height']) ? $file->override['attributes']['height'] : $file->metadata['height'], |
1303 |
'#alt' => token_replace($display['settings']['alt'], array('file' => $file), $replace_options),
|
|
1304 |
'#title' => token_replace($display['settings']['title'], array('file' => $file), $replace_options),
|
|
1383 |
'#alt' => file_entity_replace_alt($file, $replace_options, $display['settings']['alt'], $langcode),
|
|
1384 |
'#title' => file_entity_replace_title($file, $replace_options, $display['settings']['title'], $langcode),
|
|
1305 | 1385 |
); |
1306 | 1386 |
} |
1307 | 1387 |
return $element; |
drupal7/sites/all/modules/file_entity/file_entity.pages.inc | ||
---|---|---|
63 | 63 |
else { |
64 | 64 |
// For remote files, just redirect the user to that file's actual URL. |
65 | 65 |
$headers['Location'] = file_create_url($file->uri); |
66 |
// If using S3 as a replacement for the file system, default headers |
|
67 |
// for downloading will cause the server to not respond. Remove them. |
|
68 |
if (module_exists('s3fs')) { |
|
69 |
unset($headers['Content-Length']); |
|
70 |
unset($headers['Content-Transfer-Encoding']); |
|
71 |
} |
|
66 | 72 |
foreach ($headers as $name => $value) { |
67 | 73 |
drupal_add_http_header($name, $value); |
68 | 74 |
} |
... | ... | |
127 | 133 |
'#default_value' => isset($form_state['storage']['upload']) ? $form_state['storage']['upload'] : NULL, |
128 | 134 |
); |
129 | 135 |
|
136 |
$form['upload']['#description'] = t('Files must be less than !size.', array('!size' => '<strong>' . format_size($form['upload']['#upload_validators']['file_entity_validate_size_extensions'][0]) . '</strong>')); |
|
137 |
|
|
138 |
// Get list of extensions. |
|
139 |
$extensions = explode("\n", variable_get('file_entity_max_filesize_extensions')); |
|
140 |
|
|
141 |
if (!empty($extensions)) { |
|
142 |
|
|
143 |
$limits = ''; |
|
144 |
|
|
145 |
foreach ($extensions as $position => $text) { |
|
146 |
$matches = array(); |
|
147 |
preg_match('/(.*)\|(.*)/', $text, $matches); |
|
148 |
|
|
149 |
if (is_array($matches) && count($matches) == 3) { |
|
150 |
$extension = $matches[1]; |
|
151 |
$filesize = $matches[2]; |
|
152 |
|
|
153 |
$limits .= $extension . ': ' . $filesize . ','; |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
$limits = rtrim($limits, ','); |
|
158 |
|
|
159 |
$form['upload']['#description'] = t('Files must be less than !size (!limits).', array('!size' => '<strong>' . format_size($form['upload']['#upload_validators']['file_entity_validate_size_extensions'][0]) . '</strong>', '!limits' => $limits)); |
|
160 |
|
|
161 |
} |
|
162 |
|
|
130 | 163 |
$form['actions'] = array('#type' => 'actions'); |
131 | 164 |
$form['actions']['next'] = array( |
132 | 165 |
'#type' => 'submit', |
... | ... | |
138 | 171 |
return $form; |
139 | 172 |
} |
140 | 173 |
|
174 |
function file_entity_validate_size_extensions(stdClass $file, $file_limit = 0, $user_limit = 0) { |
|
175 |
global $user; |
|
176 |
$errors = array(); |
|
177 |
|
|
178 |
// Current file extension. |
|
179 |
$current_extension = pathinfo($file->filename, PATHINFO_EXTENSION); |
|
180 |
|
|
181 |
// Get list of extensions. |
|
182 |
$extensions = explode("\n", variable_get('file_entity_max_filesize_extensions')); |
|
183 |
|
|
184 |
if ($extensions) { |
|
185 |
foreach ($extensions as $position => $text) { |
|
186 |
$matches = array(); |
|
187 |
preg_match('/(.*)\|(.*)/', $text, $matches); |
|
188 |
|
|
189 |
if (is_array($matches) && count($matches) == 3) { |
|
190 |
$extension = $matches[1]; |
|
191 |
$filesize = $matches[2]; |
|
192 |
|
|
193 |
if (strtolower($extension) == strtolower($current_extension)) { |
|
194 |
$file_limit = parse_size($filesize); |
|
195 |
} |
|
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
200 |
if ($file_limit && $file->filesize > $file_limit) { |
|
201 |
$errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit))); |
|
202 |
} |
|
203 |
|
|
204 |
// Save a query by only calling file_space_used() when a limit is provided. |
|
205 |
if ($user_limit && (file_space_used($user->uid) + $file->filesize) > $user_limit) { |
|
206 |
$errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit))); |
|
207 |
} |
|
208 |
|
|
209 |
return $errors; |
|
210 |
} |
|
211 |
|
|
141 | 212 |
/** |
142 | 213 |
* Generate form fields for the second step in the add file wizard. |
143 | 214 |
*/ |
... | ... | |
265 | 336 |
|
266 | 337 |
// Determine all of the locations where a file is used, then loop through the |
267 | 338 |
// occurrences and filter out any duplicates. |
268 |
foreach (file_usage_list($file) as $module => $type) {
|
|
339 |
foreach (file_usage_list($file) as $type) { |
|
269 | 340 |
foreach ($type as $entity_type => $entity_ids) { |
270 | 341 |
// There are cases where the actual entity doesn't exist. |
271 | 342 |
// We have to handle this. |
... | ... | |
277 | 348 |
// additional usage to the total count column in the table row and |
278 | 349 |
// continue on to the next iteration of the loop. |
279 | 350 |
if (isset($occured_entities[$entity_type][$entity_id])) { |
280 |
$rows[$occured_entities[$entity_type][$entity_id]][2] += $count;
|
|
351 |
$rows[$occured_entities[$entity_type][$entity_id]][3] += $count;
|
|
281 | 352 |
continue; |
282 | 353 |
} |
283 | 354 |
|
284 | 355 |
// Retrieve the label and the URI of the entity. |
285 |
$label = empty($entities[$entity_id]) ? $module : entity_label($entity_type, $entities[$entity_id]); |
|
356 |
$label = empty($entities[$entity_id]) ? t('(entity not loaded)') : entity_label($entity_type, $entities[$entity_id]); |
|
357 |
if (empty($label)) { |
|
358 |
$label = t('(entity label not loaded)'); |
|
359 |
} |
|
286 | 360 |
$entity_uri = empty($entities[$entity_id]) ? NULL : entity_uri($entity_type, $entities[$entity_id]); |
287 | 361 |
|
288 | 362 |
// Link the label to the URI when possible. |
289 | 363 |
if (!empty($entity_uri['path']) && $entity_type != 'paragraphs_item') { |
290 |
$entity_label = l($label, $entity_uri['path']); |
|
364 |
if (empty($entity_uri['options'])) { |
|
365 |
$entity_label = l($label, $entity_uri['path']); |
|
366 |
} |
|
367 |
else { |
|
368 |
$entity_label = l($label, $entity_uri['path'], $entity_uri['options']); |
|
369 |
} |
|
291 | 370 |
} |
292 | 371 |
// For paragraphs items, we are searching for usages in nodes. |
293 | 372 |
elseif ($entity_type == 'paragraphs_item') { |
... | ... | |
311 | 390 |
$entity_label = check_plain($label); |
312 | 391 |
} |
313 | 392 |
|
314 |
$rows[] = array($entity_label, $entity_type, $count); |
|
393 |
$rows[] = array( |
|
394 |
$entity_label, |
|
395 |
$entity_id, |
|
396 |
$entity_type, |
|
397 |
$count, |
|
398 |
); |
|
315 | 399 |
|
316 | 400 |
// Record the occurrence of the entity to ensure that it isn't listed in |
317 | 401 |
// the table again. |
... | ... | |
320 | 404 |
} |
321 | 405 |
} |
322 | 406 |
|
323 |
$header = array(t('Entity'), t('Entity type'), t('Use count')); |
|
407 |
$header = array( |
|
408 |
t('Entity label'), |
|
409 |
t('Entity ID'), |
|
410 |
t('Entity type'), |
|
411 |
t('Times this file used by this entity'), |
|
412 |
); |
|
324 | 413 |
$build['usage_table'] = array( |
325 | 414 |
'#theme' => 'table', |
326 | 415 |
'#header' => $header, |
... | ... | |
1149 | 1238 |
} |
1150 | 1239 |
|
1151 | 1240 |
// There is always a file size limit due to the PHP server limit. |
1152 |
$validators['file_validate_size'] = array($max_filesize);
|
|
1241 |
$validators['file_entity_validate_size_extensions'] = array($max_filesize);
|
|
1153 | 1242 |
|
1154 | 1243 |
// Add image validators. |
1155 | 1244 |
$options += array('min_resolution' => 0, 'max_resolution' => 0); |
... | ... | |
1215 | 1304 |
$extract_location = 'temporary://' . $destination; |
1216 | 1305 |
$extract_location = file_destination($extract_location, FILE_EXISTS_RENAME); |
1217 | 1306 |
if (!file_prepare_directory($extract_location, FILE_MODIFY_PERMISSIONS | FILE_CREATE_DIRECTORY)) { |
1218 |
throw new Exception(t('Unable to prepar, a temporary directory %dir for extraction.', array('%dir' => $extract_location))); |
|
1307 |
throw new Exception(t('Unable to prepare, a temporary directory %dir for extraction.', array('%dir' => $extract_location)));
|
|
1219 | 1308 |
} |
1220 | 1309 |
|
1221 | 1310 |
// Prepare target directory where files are going to be saved. |
1222 | 1311 |
$target_dir = file_default_scheme() . '://' . $destination; |
1223 | 1312 |
$target_dir = file_destination($target_dir, FILE_EXISTS_RENAME); |
1224 | 1313 |
if (!file_prepare_directory($target_dir, FILE_MODIFY_PERMISSIONS | FILE_CREATE_DIRECTORY)) { |
1225 |
throw new Exception(t('Unable to prepar, a directory %dir for extraction.', array('%dir' => $target_dir))); |
|
1314 |
throw new Exception(t('Unable to prepare, a directory %dir for extraction.', array('%dir' => $target_dir)));
|
|
1226 | 1315 |
} |
1227 | 1316 |
|
1228 | 1317 |
$archiver->extract($extract_location); |
... | ... | |
1254 | 1343 |
// directory hierarchy of the file. |
1255 | 1344 |
$destination = pathinfo($file->uri, PATHINFO_DIRNAME); |
1256 | 1345 |
if (!file_prepare_directory($destination, FILE_MODIFY_PERMISSIONS | FILE_CREATE_DIRECTORY)) { |
1257 |
throw new Exception(t('Unable to prepar, a directory %dir for extraction.', array('%dir' => $destination))); |
|
1346 |
throw new Exception(t('Unable to prepare, a directory %dir for extraction.', array('%dir' => $destination)));
|
|
1258 | 1347 |
} |
1259 | 1348 |
|
1260 | 1349 |
if (!file_unmanaged_move($extracted_file->uri, $file->uri)) { |
drupal7/sites/all/modules/file_entity/file_entity.test | ||
---|---|---|
875 | 875 |
|
876 | 876 |
// Verify that the module name is used in place of a link to the entity. |
877 | 877 |
$this->assertNoLink('test_module'); |
878 |
$this->assertRaw('test_module', 'Module name used in place of link to the entity.');
|
|
878 |
$this->assertRaw('(entity not loaded)', '"(entity not loaded)" notice used in place of link to the entity.');
|
|
879 | 879 |
|
880 | 880 |
// Verify that the entity type and use count information is also present. |
881 | 881 |
$expected_values = array( |
drupal7/sites/all/modules/file_entity/file_entity.tokens.inc | ||
---|---|---|
169 | 169 |
unset($entity->_field_view_prepared); |
170 | 170 |
$field_output = field_view_field($entity_type, $entity, $field_name, 'token', $langcode); |
171 | 171 |
$field_output['#token_options'] = $options; |
172 |
$field_output['#prerender'][] = 'token_pre_render_field_token'; |
|
172 |
$field_output['#pre_render'][] = 'token_pre_render_field_token';
|
|
173 | 173 |
$replacements[$original] = drupal_render($field_output); |
174 | 174 |
} |
175 | 175 |
else { |
drupal7/sites/all/modules/file_entity/tests/file_entity_test.info | ||
---|---|---|
5 | 5 |
dependencies[] = file_entity |
6 | 6 |
hidden = TRUE |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2019-11-20
|
|
9 |
version = "7.x-2.27"
|
|
8 |
; Information added by Drupal.org packaging script on 2020-06-01
|
|
9 |
version = "7.x-2.28"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "file_entity" |
12 |
datestamp = "1574278088" |
|
12 |
datestamp = "1591051455" |
drupal7/sites/all/modules/views_bulk_operations/actions/modify.action.inc | ||
---|---|---|
570 | 570 |
|
571 | 571 |
$has_enabled_fields = FALSE; |
572 | 572 |
foreach ($display_values as $key) { |
573 |
if (strpos($key, $bundle_name . '::') !== FALSE) {
|
|
573 |
if (strpos($key, $bundle_name . '::') === 0) {
|
|
574 | 574 |
$has_enabled_fields = TRUE; |
575 | 575 |
} |
576 | 576 |
} |
... | ... | |
588 | 588 |
* Helper function that recursively strips #required from field widgets. |
589 | 589 |
*/ |
590 | 590 |
function _views_bulk_operations_modify_action_unset_required(&$element) { |
591 |
unset($element['#required']);
|
|
591 |
$element['#required'] = FALSE;
|
|
592 | 592 |
foreach (element_children($element) as $key) { |
593 | 593 |
_views_bulk_operations_modify_action_unset_required($element[$key]); |
594 | 594 |
} |
drupal7/sites/all/modules/views_bulk_operations/actions_permissions.info | ||
---|---|---|
3 | 3 |
package = Administration |
4 | 4 |
core = 7.x |
5 | 5 |
|
6 |
; Information added by Drupal.org packaging script on 2018-05-08
|
|
7 |
version = "7.x-3.5"
|
|
6 |
; Information added by Drupal.org packaging script on 2020-06-03
|
|
7 |
version = "7.x-3.6"
|
|
8 | 8 |
core = "7.x" |
9 | 9 |
project = "views_bulk_operations" |
10 |
datestamp = "1525821486" |
|
10 |
datestamp = "1591196779" |
drupal7/sites/all/modules/views_bulk_operations/views/views_bulk_operations.views.inc | ||
---|---|---|
17 | 17 |
'click sortable' => FALSE, |
18 | 18 |
), |
19 | 19 |
); |
20 |
// Check that the base table has the entity type key set. |
|
21 |
if (!isset($data[$info['base table']]['table']['entity type'])) { |
|
22 |
$data[$info['base table']]['table']['entity type'] = $entity_type; |
|
23 |
} |
|
20 | 24 |
} |
21 | 25 |
if (isset($info['revision table']) && isset($data[$info['revision table']]['table'])) { |
22 | 26 |
$data[$info['revision table']]['views_bulk_operations'] = array( |
drupal7/sites/all/modules/views_bulk_operations/views/views_bulk_operations_handler_field_operations.inc | ||
---|---|---|
65 | 65 |
'force_single' => array('default' => FALSE), |
66 | 66 |
'entity_load_capacity' => array('default' => 10), |
67 | 67 |
'skip_batching' => array('default' => 0), |
68 |
'save_view_object_when_batching' => array('default' => 0), |
|
68 | 69 |
), |
69 | 70 |
); |
70 | 71 |
$options['vbo_operations'] = array( |
... | ... | |
153 | 154 |
'#default_value' => $this->options['vbo_settings']['skip_batching'], |
154 | 155 |
'#description' => '<b>' . t('Warning:') . '</b> ' . t('This will cause timeouts for larger amounts of selected items.'), |
155 | 156 |
); |
157 |
$form['vbo_settings']['save_view_object_when_batching'] = array( |
|
158 |
'#type' => 'checkbox', |
|
159 |
'#title' => t('Save the whole view object when batching'), |
|
160 |
'#default_value' => $this->options['vbo_settings']['save_view_object_when_batching'], |
|
161 |
'#description' => '<b>' . t('Warning:') . '</b> ' . t('Use this option when your view contains query conditions which are not defined as arguments.'), |
|
162 |
); |
|
156 | 163 |
|
157 | 164 |
// Display operations and their settings. |
158 | 165 |
$form['vbo_operations'] = array( |
drupal7/sites/all/modules/views_bulk_operations/views_bulk_operations.drush.inc | ||
---|---|---|
75 | 75 |
* Implementation of 'vbo execute' command. |
76 | 76 |
*/ |
77 | 77 |
function views_bulk_operations_drush_execute($vid = NULL, $operation_id = NULL) { |
78 |
$args = func_get_args(); |
|
78 | 79 |
// Parse arguments. |
79 | 80 |
if (is_null($vid)) { |
80 | 81 |
drush_set_error('VIEWS_BULK_OPERATIONS_MISSING_VID', dt('Please specify a view ID to execute.')); |
... | ... | |
84 | 85 |
drush_set_error('VIEWS_BULK_OPERATIONS_MISSING_OPERATION', dt('Please specify an operation to execute.')); |
85 | 86 |
return; |
86 | 87 |
} |
87 |
$args = func_get_args(); |
|
88 | 88 |
$view_exposed_input = array(); |
89 | 89 |
$operation_arguments = array(); |
90 | 90 |
$view_arguments = array(); |
drupal7/sites/all/modules/views_bulk_operations/views_bulk_operations.info | ||
---|---|---|
9 | 9 |
files[] = plugins/operation_types/base.class.php |
10 | 10 |
files[] = views/views_bulk_operations_handler_field_operations.inc |
11 | 11 |
|
12 |
; Information added by Drupal.org packaging script on 2018-05-08
|
|
13 |
version = "7.x-3.5"
|
|
12 |
; Information added by Drupal.org packaging script on 2020-06-03
|
|
13 |
version = "7.x-3.6"
|
|
14 | 14 |
core = "7.x" |
15 | 15 |
project = "views_bulk_operations" |
16 |
datestamp = "1525821486" |
|
16 |
datestamp = "1591196779" |
drupal7/sites/all/modules/views_bulk_operations/views_bulk_operations.module | ||
---|---|---|
791 | 791 |
// Determine if the operation needs to be executed directly. |
792 | 792 |
$aggregate = $operation->aggregate(); |
793 | 793 |
$skip_batching = $vbo->get_vbo_option('skip_batching'); |
794 |
$save_view = $vbo->get_vbo_option('save_view_object_when_batching'); |
|
794 | 795 |
$force_single = $vbo->get_vbo_option('force_single'); |
795 | 796 |
$execute_directly = ($aggregate || $skip_batching || $force_single); |
796 | 797 |
// Try to load all rows without a batch if needed. |
... | ... | |
812 | 813 |
'exposed_input' => $vbo->view->get_exposed_input(), |
813 | 814 |
), |
814 | 815 |
); |
816 |
// If defined, save the whole view object. |
|
817 |
if ($save_view) { |
|
818 |
$options['view_info']['view'] = $vbo->view; |
|
819 |
} |
|
815 | 820 |
// Create an array of rows in the needed format. |
816 | 821 |
$rows = array(); |
817 | 822 |
$current = 1; |
... | ... | |
911 | 916 |
} |
912 | 917 |
|
913 | 918 |
$view_info = $options['view_info']; |
914 |
$view = views_get_view($view_info['name']); |
|
915 |
$view->set_exposed_input($view_info['exposed_input']); |
|
916 |
$view->set_arguments($view_info['arguments']); |
|
917 |
$view->set_display($view_info['display']); |
|
919 |
if (isset($view_info['view'])) { |
|
920 |
$view = $view_info['view']; |
|
921 |
// Because of the offset, we want our view to be re-build and re-executed. |
|
922 |
$view->built = FALSE; |
|
923 |
$view->executed = FALSE; |
|
924 |
} |
|
925 |
else { |
|
926 |
$view = views_get_view($view_info['name']); |
|
927 |
$view->set_exposed_input($view_info['exposed_input']); |
|
928 |
$view->set_arguments($view_info['arguments']); |
|
929 |
$view->set_display($view_info['display']); |
|
930 |
} |
|
918 | 931 |
$view->set_offset($context['sandbox']['progress']); |
919 | 932 |
$view->build(); |
920 | 933 |
$view->execute($view_info['display']); |
drupal7/sites/all/modules/views_bulk_operations/views_bulk_operations.rules.inc | ||
---|---|---|
114 | 114 |
function views_bulk_operations_views_list() { |
115 | 115 |
$selectable_displays = array(); |
116 | 116 |
foreach (views_get_enabled_views() as $name => $base_view) { |
117 |
$view = $base_view->clone_view(); |
|
118 | 117 |
foreach ($base_view->display as $display_name => $display) { |
118 |
$view = $base_view->clone_view(); |
|
119 | 119 |
if (!$view->set_display($display_name)) { |
120 | 120 |
continue; |
121 | 121 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules