function user_picture_enabled

Same name in other branches
  1. 9 core/modules/user/user.module \user_picture_enabled()
  2. 8.9.x core/modules/user/user.module \user_picture_enabled()
  3. 10 core/modules/user/user.module \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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.