I have a "title" field containing html code and I would like the HTML to be processed as HTML rather than to just display the actual HTML code. When I change the "Text Processing" setting in the SPARQL Views resource types from "Plain text" to "Filtered text", the HTML is now handled as HTML but the following error is generated at the top of the page:

Notice: Undefined index: format in _text_sanitize() (line 319 of /mydrupalsite/modules/field/modules/text/text.module).

This only occurs in the context of SPARQL Views which is why I am reporting it here. - E

CommentFileSizeAuthor
#4 sv-field-formatter-1698138-4.patch887 bytesstuartraetaylor

Comments

stuartraetaylor’s picture

I had a fix for this one but forgot to make a patch out of it at the time. I think this was the code for it, but I'd be grateful if you could try it out and let me know it solves your problem. If it does then I can extract the patch from my local testing branch.

In handlers/sparql_views_handler_field.inc - function render_field_formatter I have changed the line:

    $items[] = array('value' => $value);

to:

    $items[] = ($formatter == 'text_default') ? 
        array('value' => $value, 'format' => $field['settings']['default_formatter']) :
        array('value' => $value);

Cheers,
Stuart.

ebremer’s picture

It got worse, numerous:
"Notice: Undefined index: default_formatter in sparql_views_handler_field->render_field_formatter() (line 244 of /mysite/sites/all/modules/sparql_views/handlers/sparql_views_handler_field.inc)." errors

- E

ebremer’s picture

I was looking through the values of $field['settings'] and $field['settings']['default_formatter'] is never set. The only thing ever set is max_length.

stuartraetaylor’s picture

Status: Active » Needs review
StatusFileSize
new887 bytes

This patch should fix the errors above.

ebremer’s picture

I was away from this for a bit. Just tested the new patch, still getting a "Notice: Undefined index: format in _text_sanitize() (line 319 of /mnt/exodus/disk1/www/ebremer/modules/field/modules/text/text.module)." error.

ebremer’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)