Programmatically update allowed_html filter settings

"Cameron B. Prince" <[email protected]>
Newsgroups gmane.comp.php.drupal.devel
Message-ID <CB846143.190F9%[email protected]>
Hi,

The baseline module I'm developing needs to add the <span> tag to the
allowed_html value for the filtered_html text filter when enabled.

I've searched the core modules, the standard installation profile,
Drupal.org and Google, but I haven't been able to find an example of the
proper way to do this in a module.install's hook_enable().

I assume I should use filter_format_save() and tried the following:

filter_format_save('filtered_html', 'filter_html', 1, 1, array(
  'settings' => array(
    'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul>
<ol> <li> <dl> <dt> <dd> <span>'
    )
  )
);

This resulted in "PDOException: SQLSTATE[23000]: Integrity constraint
violation: 1048 Column 'format' cannot be null" which I don't understand
because the first argument to filter_format_save() is the format.

Could someone point me in the right direction?

Thanks,
Cameron
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.