Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. user.module

function user_picture_enabled

Returns whether this site supports the default user picture feature.

This approach preserves compatibility with node/comment templates. Alternate user picture implementations (e.g., Gravatar) should provide their own add/edit/delete forms and populate the 'picture' variable during the preprocess stage.

2 calls to user_picture_enabled()
ThemeSettingsForm::buildForm in core/modules/system/src/Form/ThemeSettingsForm.php
UserHooks::userViewAlter in core/modules/user/src/Hook/UserHooks.php
Implements hook_ENTITY_TYPE_view_alter() for user entities.

File

core/modules/user/user.module, line 29

Code

function user_picture_enabled() {
    $field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('user', 'user');
    return isset($field_definitions['user_picture']);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal