strip_tags from tokens

Created on 25 June 2015, over 10 years ago
Updated 19 December 2024, 11 months ago

alt attribute sould not contain any html tags and we have to care about that if tokens take their value from fields containing html formating. Here a solution with strip_tags:

around line 147 (imagefield_tokens_field_widget_process)

$element['alt']['#default_value'] = isset($item['alt']) ? strip_tags($item['alt']) : $settings['alt_field_default'];
$element['title']['#default_value'] = isset($item['title']) ? strip_tags($item['title']) : $settings['title_field_default'];

then at the end of the file (imagefield_tokens_field_attach_presave)

$field_data['title'] = strip_tags($field_data['title']);
$field_data['alt'] = strip_tags($field_data['alt']);
✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France erwangel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024