function FilterFormatRepositoryInterface::getDefaultFormat
Same name and namespace in other branches
- main core/modules/filter/src/FilterFormatRepositoryInterface.php \Drupal\filter\FilterFormatRepositoryInterface::getDefaultFormat()
Returns the default text format for a particular user.
The default text format is the first available format that the user is allowed to access, when the formats are ordered by weight. It should generally be used as a default choice when presenting the user with a list of possible text formats (for example, in a node creation form).
Conversely, when existing content that does not have an assigned text format needs to be filtered for display, the default text format is the wrong choice, because it is not guaranteed to be consistent from user to user, and some trusted users may have an unsafe text format set by default, which should not be used on text of unknown origin. Instead, the fallback format returned by filter_fallback_format() should be used, since that is intended to be a safe, consistent format that is always available to all users.
Parameters
\Drupal\Core\Session\AccountInterface|null $account: (optional) The user account to check. If omitted, to the currently logged-in user account will be used. Defaults to NULL.
Return value
\Drupal\filter\FilterFormatInterface The default text format for a particular user.
File
-
core/
modules/ filter/ src/ FilterFormatRepositoryInterface.php, line 71
Class
- FilterFormatRepositoryInterface
- Provides an interface for a repository for filter formats.
Namespace
Drupal\filterCode
public function getDefaultFormat(?AccountInterface $account = NULL) : FilterFormatInterface;
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.