Issue #2849861 by masipila, joelpittet, jeffwpetersen, xjm: D6 text area formatting settings not respected when migrating to D8
parent
882537ab56
commit
4b8961ed15
|
|
@ -100,28 +100,30 @@ class TextField extends CckFieldPluginBase {
|
||||||
*/
|
*/
|
||||||
public function getFieldType(Row $row) {
|
public function getFieldType(Row $row) {
|
||||||
$widget_type = $row->getSourceProperty('widget_type');
|
$widget_type = $row->getSourceProperty('widget_type');
|
||||||
|
$settings = $row->getSourceProperty('global_settings');
|
||||||
|
|
||||||
if ($widget_type == 'text_textfield') {
|
if ($widget_type == 'text_textfield') {
|
||||||
$settings = $row->getSourceProperty('global_settings');
|
|
||||||
$field_type = $settings['text_processing'] ? 'text' : 'string';
|
$field_type = $settings['text_processing'] ? 'text' : 'string';
|
||||||
if (empty($settings['max_length']) || $settings['max_length'] > 255) {
|
if (empty($settings['max_length']) || $settings['max_length'] > 255) {
|
||||||
$field_type .= '_long';
|
$field_type .= '_long';
|
||||||
}
|
}
|
||||||
return $field_type;
|
return $field_type;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if ($widget_type == 'text_textarea') {
|
||||||
|
$field_type = $settings['text_processing'] ? 'text_long' : 'string_long';
|
||||||
|
return $field_type;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($widget_type) {
|
switch ($widget_type) {
|
||||||
case 'optionwidgets_buttons':
|
case 'optionwidgets_buttons':
|
||||||
case 'optionwidgets_select':
|
case 'optionwidgets_select':
|
||||||
return 'list_string';
|
return 'list_string';
|
||||||
case 'optionwidgets_onoff':
|
case 'optionwidgets_onoff':
|
||||||
return 'boolean';
|
return 'boolean';
|
||||||
case 'text_textarea':
|
|
||||||
return 'text_long';
|
|
||||||
default:
|
default:
|
||||||
return parent::getFieldType($row);
|
return parent::getFieldType($row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,12 @@ class TextFieldTest extends UnitTestCase {
|
||||||
['list_string', 'optionwidgets_buttons'],
|
['list_string', 'optionwidgets_buttons'],
|
||||||
['list_string', 'optionwidgets_select'],
|
['list_string', 'optionwidgets_select'],
|
||||||
['boolean', 'optionwidgets_onoff'],
|
['boolean', 'optionwidgets_onoff'],
|
||||||
['text_long', 'text_textarea'],
|
['text_long', 'text_textarea', [
|
||||||
|
'text_processing' => TRUE,
|
||||||
|
]],
|
||||||
|
['string_long', 'text_textarea', [
|
||||||
|
'text_processing' => FALSE,
|
||||||
|
]],
|
||||||
[NULL, 'undefined'],
|
[NULL, 'undefined'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -157,7 +162,8 @@ class TextFieldTest extends UnitTestCase {
|
||||||
* @dataProvider getFieldTypeProvider
|
* @dataProvider getFieldTypeProvider
|
||||||
*/
|
*/
|
||||||
public function testGetFieldType($expected_type, $widget_type, array $settings = []) {
|
public function testGetFieldType($expected_type, $widget_type, array $settings = []) {
|
||||||
$row = new Row(['widget_type' => $widget_type], ['widget_type' => []]);
|
$row = new Row();
|
||||||
|
$row->setSourceProperty('widget_type', $widget_type);
|
||||||
$row->setSourceProperty('global_settings', $settings);
|
$row->setSourceProperty('global_settings', $settings);
|
||||||
$this->assertSame($expected_type, $this->plugin->getFieldType($row));
|
$this->assertSame($expected_type, $this->plugin->getFieldType($row));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue