Révision e9f59589
Ajouté par Assos Assos il y a presque 10 ans
drupal7/sites/all/modules/field_group/field_group.install | ||
---|---|---|
310 | 310 |
|
311 | 311 |
// Only update feature field_groups this time. |
312 | 312 |
// Don't touch the fieldgroups in db. |
313 |
|
|
313 | 314 |
if ($row->export_type == EXPORT_IN_CODE) { |
314 |
$classes = explode(" ", $row->data['format_settings']['instance_settings']['classes']); |
|
315 |
$classes = array(); |
|
316 |
|
|
317 |
if (isset($row->data['format_settings'], $row->data['format_settings']['instance_settings'], $row->data['format_settings']['instance_settings']['classes'])) { |
|
318 |
$classes = explode(" ", $row->data['format_settings']['instance_settings']['classes']); |
|
319 |
} |
|
320 |
|
|
315 | 321 |
$optional_classes = array(str_replace("_", "-", $row->group_name), 'field-group-' . $row->data['format_type']); |
316 | 322 |
foreach ($optional_classes as $optional_class) { |
317 | 323 |
if (!in_array($optional_class, $classes)) { |
... | ... | |
325 | 331 |
} |
326 | 332 |
|
327 | 333 |
} |
334 |
|
|
335 |
/** |
|
336 |
* Id attributes are now a setting. This update will insert the old id in the setting so old |
|
337 |
* markup doesn't get broken. If you don't want an attribute, you can delete |
|
338 |
* them on the fieldgroup settings. |
|
339 |
*/ |
|
340 |
function field_group_update_7007() { |
|
341 |
|
|
342 |
ctools_include("export"); |
|
343 |
|
|
344 |
// Migrate the field groups so they have a unique identifier. |
|
345 |
$field_groups = ctools_export_load_object("field_group"); |
|
346 |
foreach ($field_groups as $row) { |
|
347 |
if ($row->data['format_type'] == 'div' || $row->data['format_type'] == 'html5' || $row->data['format_type'] == 'html-element') { |
|
348 |
|
|
349 |
// If mode is default, we don't know what view mode it was. Take full then. |
|
350 |
$view_mode = $row->mode == 'default' ? 'full' : $row->mode; |
|
351 |
$id = $row->entity_type . '_' . $row->bundle . '_' . $view_mode . '_' . $row->group_name; |
|
352 |
$row->data['format_settings']['instance_settings']['id'] = $id; |
|
353 |
} |
|
354 |
|
|
355 |
if ($row->export_type == EXPORT_IN_CODE) { |
|
356 |
unset($row->id); |
|
357 |
drupal_write_record('field_group', $row); |
|
358 |
} |
|
359 |
else { |
|
360 |
drupal_write_record('field_group', $row, array('id')); |
|
361 |
} |
|
362 |
} |
|
363 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules