8.5.x filter.module filter_formats(AccountInterface $account = NULL)
8.0.x filter.module filter_formats(AccountInterface $account = NULL)
8.1.x filter.module filter_formats(AccountInterface $account = NULL)
8.2.x filter.module filter_formats(AccountInterface $account = NULL)
8.3.x filter.module filter_formats(AccountInterface $account = NULL)
8.4.x filter.module filter_formats(AccountInterface $account = NULL)
8.6.x filter.module filter_formats(AccountInterface $account = NULL)
4.6.x filter.module filter_formats()
4.7.x filter.module filter_formats()
5.x filter.module filter_formats()
6.x filter.module filter_formats($index = NULL)
7.x filter.module filter_formats($account = NULL)

Retrieves a list of text formats, ordered by weight.


$account: (optional) If provided, only those formats that are allowed for this user account will be returned. All formats will be returned otherwise. Defaults to NULL.

Return value

An array of text format objects, keyed by the format ID and ordered by weight.

See also


9 calls to filter_formats()
FilterCRUDTestCase::testTextFormatCRUD in modules/filter/filter.test
Tests CRUD operations for text formats and filters.
FilterFormatAccessTestCase::testFormatPermissions in modules/filter/filter.test
Tests the Filter format access permissions functionality.
filter_admin_overview in modules/filter/filter.admin.inc
Page callback: Form constructor for a form to list and reorder text formats.
filter_default_format in modules/filter/filter.module
Returns the ID of the default text format for a particular user.
filter_format_load in modules/filter/filter.module
Loads a text format object from the database.

... See full list

5 string references to 'filter_formats'
drupal-6.bare.database.php in modules/simpletest/tests/upgrade/drupal-6.bare.database.php
drupal-6.filled.database.php in modules/simpletest/tests/upgrade/drupal-6.filled.database.php
FilterAdminTestCase::testFilterAdmin in modules/filter/filter.test
Tests filter administration functionality.
filter_formats_reset in modules/filter/filter.module
Resets the text format caches.
filter_update_7000 in modules/filter/filter.install
Upgrade the {filter_formats} table and rename it to {filter_format}.


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


function filter_formats($account = NULL) {
  global $language;
  $formats =& drupal_static(__FUNCTION__, array());

  // All available formats are cached for performance.
  if (!isset($formats['all'])) {
    if ($cache = cache_get("filter_formats:{$language-&gt;<span class="php-function-or-constant property member-of-variable">language</span>}")) {
      $formats['all'] = $cache->data;
    else {
      $formats['all'] = db_select('filter_format', 'ff')
        ->condition('status', 1)
      cache_set("filter_formats:{$language-&gt;<span class="php-function-or-constant property member-of-variable">language</span>}", $formats['all']);

  // Build a list of user-specific formats.
  if (isset($account) && !isset($formats['user'][$account->uid])) {
    $formats['user'][$account->uid] = array();
    foreach ($formats['all'] as $format) {
      if (filter_access($format, $account)) {
        $formats['user'][$account->uid][$format->format] = $format;
  return isset($account) ? $formats['user'][$account->uid] : $formats['all'];