Same name and namespace in other branches
  1. 8.9.x core/modules/filter/filter.module \filter_fallback_format()
  2. 9 core/modules/filter/filter.module \filter_fallback_format()

Returns the ID of the fallback text format that all users have access to.

The fallback text format is a regular text format in every respect, except it does not participate in the filter permission system and cannot be disabled. It needs to exist because any user who has permission to create formatted content must always have at least one text format they can use.

Because the fallback format is available to all users, it should always be configured securely. For example, when the Filter module is installed, this format is initialized to output plain text. Installation profiles and site administrators have the freedom to configure it further.

Note that the fallback format is completely distinct from the default format, which differs per user and is simply the first format which that user has access to. The default and fallback formats are only guaranteed to be the same for users who do not have access to any other format; otherwise, the fallback format's weight determines its placement with respect to the user's other formats.

Any modules implementing a format deletion functionality must not delete this format.

Return value

The ID of the fallback text format.

See also

hook_filter_format_disable()

filter_default_format()

14 calls to filter_fallback_format()
check_markup in modules/filter/filter.module
Runs all the enabled filters on a piece of text.
FilterAdminTestCase::testFilterAdmin in modules/filter/filter.test
Tests filter administration functionality.
FilterFormatAccessTestCase::testFormatPermissions in modules/filter/filter.test
Tests the Filter format access permissions functionality.
FilterFormatAccessTestCase::testFormatRoles in modules/filter/filter.test
Tests if text format is available to a role.
FilterFormatAccessTestCase::testFormatWidgetPermissions in modules/filter/filter.test
Tests editing a page using a disallowed text format.

... See full list

2 string references to 'filter_fallback_format'
filter_install in modules/filter/filter.install
Implements hook_install().
filter_update_7005 in modules/filter/filter.install
Integrate text formats with the user permissions system.

File

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

Code

function filter_fallback_format() {

  // This variable is automatically set in the database for all installations
  // of Drupal. In the event that it gets disabled or deleted somehow, there
  // is no safe default to return, since we do not want to risk making an
  // existing (and potentially unsafe) text format on the site automatically
  // available to all users. Returning NULL at least guarantees that this
  // cannot happen.
  return variable_get('filter_fallback_format');
}