function user_picture_enabled in Drupal 8
Same name and namespace in other branches
- 9 core/modules/user/user.module \user_picture_enabled()
- 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 - 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 - Enables the user registration and login system.
Code
function user_picture_enabled() {
$field_definitions = \Drupal::service('entity_field.manager')
->getFieldDefinitions('user', 'user');
return isset($field_definitions['user_picture']);
}