How to alter the processing of signwriter_filter depending on a template variable ?

open-keywords - November 18, 2008 - 08:43
Project:Signwriter
Version:5.x-1.x-dev
Component:Documentation
Category:support request
Priority:normal
Assigned:Justin W Freeman
Status:closed
Description

I would like to change the color of the output depending on taxonomy values on a node.

The text to transform is entered through TinyMCE, then I use the input filter.
How can I alter the rendering to change the default color of the signwriter profile depending on the node ?

Thanks for your help

#1

Justin W Freeman - November 19, 2008 - 01:17
Assigned to:Anonymous» Justin W Freeman
Status:active» closed

I have added Example 4 to the documentation page, http://drupal.org/node/336075

#2

open-keywords - November 19, 2008 - 10:06

Thanks for your efforts in documentation.

However, the example uses signwriter_title_convert(), it doesn't apply when signwriter_filter() is used to process text entered in a textarea.

I wonder if there is a way to alter/hook the signwriter_filter() function from the theme ?

Regards

#3

Justin W Freeman - November 19, 2008 - 20:27

Yes, I see your point. This is not really a hook_filter capability since it has no node context to work with, http://api.drupal.org/api/function/hook_filter/5.

However, you could do this by:

  1. Creating Signwriter filters for each Taxonomy term - one for each unique colour
  2. Create a custom module that contains your term switching logic and changing the node->format (input format) to the required filter on the node insert or update, http://api.drupal.org/api/function/hook_nodeapi/5

This is pretty clunky but it should work, no doubt there are other methods too.

I look forward to seeing you post your final solution here :)

 
 

Drupal is a registered trademark of Dries Buytaert.