Comments

a_thakur’s picture

Status: Active » Needs review
StatusFileSize
new5.08 KB

Please find the attached patch. The patch removes the usage of the function.

[ashish@xeon:~/proj/self/d8/data/drupal8]$grep user_format_name -r *
core/modules/file/src/Tests/FileTokenReplaceTest.php:    $tests['[file:owner]'] = String::checkPlain(user_format_name($this->admin_user));
core/modules/user/user.module:function user_format_name(AccountInterface $account) {
core/modules/user/src/Plugin/entity_reference/selection/UserSelection.php:            ->where(str_replace('anonymous_name', ':anonymous_name', (string) $value_part), $value_part->arguments() + array(':anonymous_name' => user_format_name(user_load(0))))
core/modules/user/src/Entity/User.php: *   label_callback = "user_format_name",
core/modules/user/src/Entity/User.php:    \Drupal::moduleHandler()->alter('user_format_name', $name, $this);
core/modules/user/user.api.php: * Called by user_format_name() to allow modules to alter the username that's
core/modules/user/user.api.php: *   The string that user_format_name() will return.
core/modules/user/user.api.php: *   The account object passed to user_format_name().
core/modules/user/user.api.php: * @see user_format_name()
core/modules/user/user.api.php:function hook_user_format_name_alter(&$name, $account) {
core/includes/bootstrap.inc: * $text = t("@name's blog", array('@name' => user_format_name($account)));
core/lib/Drupal/Core/Session/UserSession.php:    \Drupal::moduleHandler()->alter('user_format_name', $name, $this);
core/lib/Drupal/Core/Session/AccountInterface.php:   * hook_user_format_name_alter(&$name, $account).
core/lib/Drupal/Core/Session/AccountInterface.php:   * @see hook_user_format_name_alter()

Status: Needs review » Needs work

The last submitted patch, 1: remove-usage-user_format_name-2311219-1.patch, failed testing.

undertext’s picture

Status: Needs work » Needs review
StatusFileSize
new9.5 KB

@a_thakur You have a typo in the patch : $accout variable obviously should be $account.
Also we should remove 'label_callback' from core/modules/user/src/Entity/User model
Here is a new patch.
Waiting for testbot.

Status: Needs review » Needs work

The last submitted patch, 3: edit_issue_remove_usage-2311219-1.patch, failed testing.

damiankloip’s picture

I think this issue should wait on #2112679: getUsername() should return the username getDisplayName() for the formatted user name. Then it can just use getDisplayName() ?

ianthomas_uk’s picture

Status: Needs work » Postponed
mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new16.72 KB

I think this issue is more important than the other, in terms of preparing for release. It only deprecates a @deprecated function, while #2112679: getUsername() should return the username getDisplayName() for the formatted user name is more disruptive.

The patch in #3 needed a reroll, so here it is.

Status: Needs review » Needs work

The last submitted patch, 7: 2311219_7.patch, failed testing.

mile23’s picture

Status: Needs work » Needs review
StatusFileSize
new16.47 KB

Ewps... Missed a <<<<<<< HEAD.

Status: Needs review » Needs work

The last submitted patch, 9: 2311219_9.patch, failed testing.

mile23’s picture

Status: Needs work » Needs review
StatusFileSize
new18.61 KB
new2.14 KB

This takes care of all usages I could find, but it's doubtful this will pass the testbot.

Status: Needs review » Needs work

The last submitted patch, 11: 2311219_11.patch, failed testing.

mile23’s picture

Did some analysis, and we really need to fix #2450793: Properly deprecate support for entity type label callbacks before another reroll here.

mile23’s picture

Status: Needs work » Postponed
xjm’s picture

Per #2450793: Properly deprecate support for entity type label callbacks, it looks like this was deprecated when it's not possible to remove it yet. So we should change the deprecation to remove it for 9.0 instead. We can then proceed with removing the internal uses in 8.1.x.

cilefen’s picture

Version: 8.0.x-dev » 8.1.x-dev
xjm’s picture

Thanks @cilefen!

cilefen’s picture

I removed this from the list in the issue summary of the META.

xjm’s picture

Issue summary: View changes
xjm’s picture

Issue summary: View changes
vadim.hirbu’s picture

StatusFileSize
new7.88 KB
vadim.hirbu’s picture

Status: Postponed » Needs review

Status: Needs review » Needs work

The last submitted patch, 22: remove_usage_of-2311219-22.patch, failed testing.

cilefen’s picture

@vadim.hirbu I recommend starting by re-rolling the #11 patch.

xjm’s picture

Status: Needs work » Postponed

Thanks @vadim.hirbu and @cilefen -- To clarify, this issue is postponed until 8.1.x opens for development. These sorts of internal cleanups are postponed now so that we can focus on the prioritized changes for the beta.

We could use your help in #2495301: Deprecate user_format_name() and the label_callback for 9.x (not 8.x) though!

xjm’s picture

Issue tags: -Novice
mile23’s picture

user_format_name() is still marked as deprecated for removal before 8.0.0. Adding the appropriate parent. Change this if the other issue ever commits.

mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new933 bytes

user_format_name() only appears in API documentation at this point.

This patch removes it.

Related: #2649216: Add missing type hinting to User module docblocks, Part II

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mile23’s picture

Title: Remove usage of function user_format_name() » Remove references to function user_format_name() from documentation
Version: 8.2.x-dev » 8.1.x-dev

Patch in #30 still applies. Setting to 8.1.x because it's a docs-only change. (All usages of user_format_name() are gone.)

jaheer3’s picture

I have applied the the patch #30 on 8.1.x branch it works fine so I will push this to RTBC.

daffie’s picture

Status: Needs review » Reviewed & tested by the community

@jahirul.islam@srijan.in: If you follow the proces of reviewing a patch you may change the status to RTBC.

The patch is for me too RTBC.

a_thakur’s picture

+1 for RTBC

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 30: 2311219_30.patch, failed testing.

mile23’s picture

Status: Needs work » Reviewed & tested by the community

Setting back to RTBC after unrelated fail.

  • xjm committed 5250997 on 8.2.x
    Issue #2311219 by Mile23, a_thakur, vadim.hirbu, undertext, xjm, cilefen...

  • xjm committed 0dc32d7 on 8.1.x
    Issue #2311219 by Mile23, a_thakur, vadim.hirbu, undertext, xjm, cilefen...
xjm’s picture

Title: Remove references to function user_format_name() from documentation » Fix hook_user_format_name_alter() documentation and stop referring to user_format_name()
Status: Reviewed & tested by the community » Fixed

All usages of user_format_name() are gone.)

Actually, this still appears to be used as a label callback:
core/modules/user/src/Entity/User.php: * label_callback = "user_format_name",

That said, that can be covered by the removal of all deprecated function usages that is required to open 9.x, so we do not need a separate issue at this time. (Other references are to the alter hook, so that was the only one I found other than the docs here.) The docs fixes here look fine on their own though, so rescoping slightly to focus on that. Committed 5250997 and pushed to 8.2.x and 8.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.