Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hardcoded filtered_html format set in the ResourceFieldEntityText #1063

Open
wants to merge 1 commit into
base: 7.x-2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/Plugin/resource/Field/ResourceFieldEntityText.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ public function preprocess($value) {
if (!$instance['settings']['text_processing']) {
return $value;
}

if (isset($value['value'], $value['format'])) {
return array(
'value' => $value['value'],
'format' => $value['format'],
);
}
// Fallback to the initial behavior to support BC.
return array(
'value' => $value,
// TODO: This is hardcoded! Fix it.
'format' => 'filtered_html',
);
}
Expand All @@ -43,7 +48,14 @@ public function preprocess($value) {
if (!$instance['settings']['text_processing']) {
$return[$delta] = $single_value;
}
elseif (isset($single_value['value'], $single_value['format'])) {
$return[$delta] = array(
'value' => $single_value['value'],
'format' => $single_value['format'],
);
}
else {
// Fallback to the initial behavior to support BC.
$return[$delta] = array(
'value' => $single_value,
'format' => 'filtered_html',
Expand Down