Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When adding a field of type:
$form['textarea'] = array(
'#type' => 'text_format',
'#format' => 'full_html',
'#title' => 'Form element'
);
And the validation of the form fails, the values for these field types are empty.
The problem is caused by /src/Plugin/Alter/ElementInfo.php on line 37:
$element['#input'] = $types[$element['#base_type']]['#input']
When commenting out this line, the problem is solved, but I don't think this is a solid solution?
I added a small example module that exposes a form to demonstrate the problem. Just install it and make sure you are using boostrap as default theme. Then enter a value and submit the form. You will see that the value has magically disappeared :)
Comment | File | Size | Author |
---|---|---|---|
text_format_example.zip | 1.77 KB | robin.ingelbrecht |
Comments
Comment #2
robin.ingelbrecht CreditAttribution: robin.ingelbrecht commentedComment #3
robin.ingelbrecht CreditAttribution: robin.ingelbrecht commentedComment #4
robin.ingelbrecht CreditAttribution: robin.ingelbrecht commentedComment #5
markhalliwellI looked through what code actually uses
#base_type
and it appears that only the filter/text modules do (for the text_format element). I think this entire code is unnecessary and should come out. It was probably introduced as an artifact from some old code.Comment #8
markhalliwell