function filter_update_7001

Break out "escape HTML filter" option to its own filter.

Related topics

File

modules/filter/filter.install, line 199

Code

function filter_update_7001() {
    $result = db_query("SELECT format FROM {filter_format}")->fetchCol();
    $insert = db_insert('filters')->fields(array(
        'format',
        'module',
        'delta',
        'weight',
    ));
    foreach ($result as $format_id) {
        // Deprecated constants FILTER_HTML_STRIP = 1 and FILTER_HTML_ESCAPE = 2.
        if (variable_get('filter_html_' . $format_id, 1) == 2) {
            $insert->values(array(
                'format' => $format_id,
                'module' => 'filter',
                'delta' => 4,
                'weight' => 0,
            ));
        }
        variable_del('filter_html_' . $format_id);
    }
    $insert->execute();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.