diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 0872f6f..c8974e6 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -9,6 +9,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Template\Attribute; use Drupal\filter\Plugin\Core\Entity\FilterFormat; +use Drupal\user\UserInterface; /** * Non-HTML markup language filters that generate HTML. @@ -251,6 +252,10 @@ function filter_formats($account = NULL) { // Build a list of user-specific formats. if (isset($account) && !isset($formats['user'][$account->uid])) { + // Ensure we have a proper user object. + if (!($account instanceof UserInterface)) { + $account = entity_load('user', $account->uid); + } $formats['user'][$account->uid] = array(); foreach ($formats['all'] as $format) { if ($format->access('view', $account)) {