user_user_view(array &$build, UserInterface $account, EntityViewDisplayInterface $display)
Implements hook_ENTITY_TYPE_view() for user entities.
File
- core/modules/user/user.module, line 372
- Enables the user registration and login system.
Code
1 2 3 4 5 6 7 8 | function user_user_view( array & $build , UserInterface $account , EntityViewDisplayInterface $display ) { if ( $display ->getComponent( 'member_for' )) { $build [ 'member_for' ] = array ( '#type' => 'item' , '#markup' => '<h4 class="label">' . t( 'Member for' ) . '</h4> ' . \Drupal::service( 'date.formatter' )->formatTimeDiffSince( $account ->getCreatedTime()), ); } } |
Please login to continue.