- Issue created by @cedewey
- 🇮🇳India sidharth_soman Bangalore
I am not able to see the 'Array' text after following the steps to reproduce the bug. Could you share the configuration you used for field_redirect as well as maybe the field's configuration?
Tested on Drupal 10.2.0 and PHP 8.1.4
- 🇺🇸United States liberatr Portland, OR
I have the same issue on Drupal 10, and I see an error message:
"Warning: Array to string conversion in Drupal\field_redirect\Service\UtilityService->formAlter() (line 325 of modules/contrib/field_redirect/src/Service/UtilityService.php)." - 🇺🇸United States liberatr Portland, OR
The line in question is trying to concatenate an object and an array:
$widget['uri']['#description'] = $message . $widget['uri']['#description'];
My guess is that there is some module making the #description into a render array.
Here is a DSM of what is in that variable for me:
array:2 [▼ "#theme" => "item_list" "#items" => array:2 [▼ 0 => Drupal\Core\Field \ FieldFilteredMarkup {#2576 ▼ #string: "Redirect users to this URL when clicked. If this field is blank, they will remain on the site." } 1 => Drupal\Core\StringTranslation \ TranslatableMarkup {#2559 ▼ #string: " Start typing the title of a piece of content to select it. You can also enter an internal path such as %add-node or an external URL such as %url. Enter %front t ▶ " #arguments: array:5 [▶] #translatedMarkup: null #options: [] #stringTranslation: Drupal\Core\StringTranslation \ TranslationManager {#392 ▶} } ] ]
I wonder if adding this message to the beginning or end of the array would work, and if for some reason that value is not already an array, make it so:
$widget['uri']['#description']['#items'][] = $message;