You are here

protected function FieldGroup::transformEntityFormDisplaySettings in Field Group 8

Same name and namespace in other branches
  1. 8.3 contrib/field_group_migrate/src/Plugin/migrate/source/d6/FieldGroup.php \Drupal\field_group_migrate\Plugin\migrate\source\d6\FieldGroup::transformEntityFormDisplaySettings()
1 call to FieldGroup::transformEntityFormDisplaySettings()
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 58

Class

FieldGroup
Drupal 6 field_group source.

Namespace

Drupal\field_group_migrate\Plugin\migrate\source\d6

Code

protected function transformEntityFormDisplaySettings(Row $row) {
  $row
    ->setSourceProperty('extracted_settings', $row
    ->getSourceProperty('settings/form'));
  $source_settings = $row
    ->getSourceProperty('extracted_settings');
  $settings = [
    'format_type' => 'details',
    'format_settings' => [],
  ];
  switch ($source_settings['style']) {
    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;
  }
  $row
    ->setSourceProperty('converted_settings', $settings);
}