function user_picture_enabled

Same name in other branches
  1. 9 core/modules/user/user.module \user_picture_enabled()
  2. 10 core/modules/user/user.module \user_picture_enabled()
  3. 11.x 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
user_user_view_alter in core/modules/user/user.module
Implements hook_ENTITY_TYPE_view_alter() for user entities.

File

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

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.