protected function FieldGroup::transformEntityViewDisplaySettings in Field Group 8
Same name and namespace in other branches
- 8.3 contrib/field_group_migrate/src/Plugin/migrate/source/d6/FieldGroup.php \Drupal\field_group_migrate\Plugin\migrate\source\d6\FieldGroup::transformEntityViewDisplaySettings()
1 call to FieldGroup::transformEntityViewDisplaySettings()
- FieldGroup::prepareRow in contrib/
field_group_migrate/ src/ Plugin/ migrate/ source/ d6/ FieldGroup.php - Adds additional data to the row.
File
- contrib/
field_group_migrate/ src/ Plugin/ migrate/ source/ d6/ FieldGroup.php, line 99
Class
- FieldGroup
- Drupal 6 field_group source.
Namespace
Drupal\field_group_migrate\Plugin\migrate\source\d6Code
protected function transformEntityViewDisplaySettings(Row $row) {
$row
->setSourceProperty('extracted_settings', $row
->getSourceProperty('settings/display'));
$view_modes = array_diff(array_keys($row
->getSourceProperty('extracted_settings')), [
'label',
'description',
'weight',
]);
$view_modes = array_filter($view_modes, function ($value) {
return !is_numeric($value);
});
$row
->setSourceProperty('view_mode_keys', $view_modes);
$view_modes = [];
foreach ($row
->getSourceProperty('view_mode_keys') as $view_mode) {
$source_settings = $row
->getSourceProperty('extracted_settings/' . $view_mode);
$row
->setSourceProperty('view_modes', []);
$settings = [
'format_type' => 'details',
'format_settings' => [],
];
switch ($source_settings['format']) {
case 'no_style':
$settings['format_type'] = 'no_style';
break;
case 'simple':
$settings['format_type'] = 'html_element';
$settings['format_settings']['element'] = 'div';
$settings['format_settings']['label_element'] = 'h2';
break;
case 'fieldset':
$settings['format_type'] = 'fieldset';
break;
case 'fieldset_collapsible':
$settings['format_type'] = 'details';
$settings['format_settings']['open'] = TRUE;
break;
case 'fieldset_collapsed':
$settings['format_type'] = 'details';
$settings['format_settings']['open'] = FALSE;
break;
case 'hidden':
$settings['format_type'] = 'hidden';
break;
}
/**
* @todo: ?
*/
if ($view_mode == 'full') {
$view_mode = 'default';
}
// $row->setSourceProperty('view_modes/' . $view_mode, $settings);
$view_modes[$view_mode] = $settings;
}
$row
->setSourceProperty('view_modes', $view_modes);
}