Unverified Commit deb93f5f authored by larowlan's avatar larowlan
Browse files

Issue #3241265 by alexpott: user_user_view() triggers a deprecation in PHP 8.1

parent 9c2be570
...@@ -299,7 +299,7 @@ function user_is_blocked($name) { ...@@ -299,7 +299,7 @@ function user_is_blocked($name) {
* Implements hook_ENTITY_TYPE_view() for user entities. * Implements hook_ENTITY_TYPE_view() for user entities.
*/ */
function user_user_view(array &$build, UserInterface $account, EntityViewDisplayInterface $display) { function user_user_view(array &$build, UserInterface $account, EntityViewDisplayInterface $display) {
if ($display->getComponent('member_for')) { if ($account->isAuthenticated() && $display->getComponent('member_for')) {
$build['member_for'] = [ $build['member_for'] = [
'#type' => 'item', '#type' => 'item',
'#markup' => '<h4 class="label">' . t('Member for') . '</h4> ' . \Drupal::service('date.formatter')->formatTimeDiffSince($account->getCreatedTime()), '#markup' => '<h4 class="label">' . t('Member for') . '</h4> ' . \Drupal::service('date.formatter')->formatTimeDiffSince($account->getCreatedTime()),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment