function filter_list_format

cis7 filter.module filter_list_format($format_id)
cle7 filter.module filter_list_format($format_id)
elmsmedia7 filter.module filter_list_format($format_id)
icor7 filter.module filter_list_format($format_id)
meedjum_blog7 filter.module filter_list_format($format_id)
mooc7 filter.module filter_list_format($format_id)

Retrieves a list of filters for a given text format.

Note that this function returns all associated filters regardless of whether they are enabled or disabled. All functions working with the filter information outside of filter administration should test for $filter->status before performing actions with the filter.

Parameters

$format_id: The format ID to retrieve filters for.

Return value

An array of filter objects associated to the given text format, keyed by filter name.

9 calls to filter_list_format()
check_markup in modules/filter/filter.module
Runs all the enabled filters on a piece of text.
ctools_custom_content_type_admin_info in sites/all/modules/ulmus/ctools/plugins/content_types/custom/custom.inc
Callback to provide administrative info. In this case we'll render the content as long as it's not PHP, which is too risky to render here.
features_filter_format_load in sites/all/modules/ulmus/features/includes/features.filter.inc
Load a filter format by its name.
filter_admin_format_form in modules/filter/filter.admin.inc
Form constructor for the text format add/edit form.
media_update_7013 in sites/all/modules/ulmus/media/media.install
Work around a core bug where text format cacheability is not updated.

... See full list

1 string reference to 'filter_list_format'
filter_formats_reset in modules/filter/filter.module
Resets the text format caches.

File

modules/filter/filter.module, line 691
Framework for handling the filtering of content.

Code

function filter_list_format($format_id) {
  $filters = &drupal_static(__FUNCTION__, array());
  $filter_info = filter_get_filters();

  if (!isset($filters['all'])) {
    if ($cache = cache_get('filter_list_format')) {
      $filters['all'] = $cache->data;
    }
    else {
      $result = db_query('SELECT * FROM {filter} ORDER BY weight, module, name');
      foreach ($result as $record) {
        $filters['all'][$record->format][$record->name] = $record;
      }
      cache_set('filter_list_format', $filters['all']);
    }
  }

  if (!isset($filters[$format_id])) {
    $format_filters = array();
    $filter_map = isset($filters['all'][$format_id]) ? $filters['all'][$format_id] : array();
    foreach ($filter_map as $name => $filter) {
      if (isset($filter_info[$name])) {
        $filter->title = $filter_info[$name]['title'];
        // Unpack stored filter settings.
        $filter->settings = (isset($filter->settings) ? unserialize($filter->settings) : array());
        // Merge in default settings.
        if (isset($filter_info[$name]['default settings'])) {
          $filter->settings += $filter_info[$name]['default settings'];
        }

        $format_filters[$name] = $filter;
      }
    }
    $filters[$format_id] = $format_filters;
  }

  return isset($filters[$format_id]) ? $filters[$format_id] : array();
}