My coworker (JensH) has started to port Realname Module to Drupal 8. I reviewed it and fixed a couple of small issues. So the most credit goes to him. There are a few @todos left and there is not upgrade path from D7 atm.

The biggest issue is in NodeFormController. NodeFormController::form uses $node->getAuthor()->getUsername() which means the users realname is used as default value in the form. Which means the node submit action does not validate anymore.

I think we have to override the form controller or change the values in $form_state somewhere. This is a general problem in all entity forms.

I tried to override the User autocomplete service in RealnameServiceProvider. It is possible but i think it should be configurable.

Please review!
Thanks!

CommentFileSizeAuthor
realname-d8.patch27.64 KBwebflo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hass’s picture

I made some commits to D7 that fixes bugs. Please re-role with this changes so we do not run into regressions.

hass’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev

Created 8.x branch for you.

hass’s picture

Status: Active » Needs work

Needs re-role.

hass’s picture

Just a quick review...

+++ b/realname.module
@@ -312,7 +242,7 @@ function realname_delete_multiple(array $uids) {
-  db_truncate('realname')->execute();
+  db_delete('realname')->execute();
   drupal_static_reset('realname_load_multiple');

That's not correct.

It looks like this patch removes Entity Reference support.

tkuldeep17’s picture

Assigned: Unassigned » tkuldeep17
id.tarzanych’s picture

@tkulldeep17
Do you have some results for this issue
Can I try to develop porting patch for drupal 8.0.0-beta10?

cassio’s picture

So I'm reading about Drupal 8 module ports, and some of them say "partial" including media, and some others.

I think this is a wonderful approach to have basic functionality in core. If Token is going to be in core, then real name is an extension of token.

If we are going to hold up this port because of Entity Reference, then I think we should partially port it until we have the entity reference fixed. And I do not deny that entity reference is one of the things that makes Drupal great. As an intermediate Drupal developer, I mostly see it used by Organic Groups and Drupal Commerce, although I am always connecting the dots in new ways.

That goes to show it should be remedied, but it should not be a block. Right now, my one site uses it to send e-mail as a token, and real name's lack of readiness may prevent that port, which is hazardous given Drupal 6's soon to be end of life.

--Sam

tkuldeep17’s picture

Assigned: tkuldeep17 » Unassigned

  • hass committed 1dd1f5e on 8.x-1.x authored by webflo
    Issue #2133627 by webflo, hass: Upgrade .info
    

  • hass committed 0695e15 on 8.x-1.x authored by webflo
    Issue #2133627 by webflo: Upgrade config
    

  • hass committed 6a7510a on 8.x-1.x
    Issue #2133627 by hass: Upgrade settings form
    

  • hass committed f6faa67 on 8.x-1.x
    Issue #2133627 by hass: Move config and add schema
    

  • hass committed 39c7342 on 8.x-1.x
    Issue #2133627 by hass: Short array syntax conversion, fix url
    

  • hass committed 4e1c26e on 8.x-1.x
    Issue #2133627 by hass: Disable warning, upgrade hooks and uninstall no...

  • hass committed e1cf3df on 8.x-1.x
    Issue #2133627 by hass: hook_requirement() and variable should no longer...

  • hass committed 2ef4fa8 on 8.x-1.x
    Issue #2133627 by hass: Remove 'name-raw' token as core has
    'account-...
hass’s picture

  • hass committed 361163e on 8.x-1.x
    Issue #2133627 by webflo, hass: Upgrade routing and menus/tabs
    

  • hass committed 7e1a8a3 on 8.x-1.x
    Issue #2133627 by webflo, hass: Upgrade README
    

  • hass committed 7db43d0 on 8.x-1.x
    Issue #2133627 by hass: Migrate permissions
    

  • hass committed e8cea41 on 8.x-1.x
    Issue #2133627 by hass: hook_menu has been replaced by routing
    

  • hass committed 739e95f on 8.x-1.x
    Issue #2133627 by hass: Migrate hook_help()
    

  • hass committed 4413fb7 on 8.x-1.x
    Issue #2133627 by hass: Default setting requires D8 token 'account-name'
    

  • hass committed 7d8e501 on 8.x-1.x
    Issue #2133627 by hass: With new D8 tokens we do not need to validate...
hass’s picture

TODO: Test if we really need the recursion protection validation any longer.

hass’s picture

@webflo: Can you help reroling the missing parts, please? The code in the sandbox is such old... we need to check every line as a lot of things have changed and/or are no longer working because of core changes. The sandbox is also not based on the latest D7 code.

  • hass committed e6fc7a0 on 8.x-1.x
    Issue #2133627 by hass: Update tests with new D8 token
    
hass’s picture

We may also rethink if we should rename the module to Display name. It does not give us anything real, but we follow the new naming of the display-name token.

  • hass committed 3cf28e6 on 8.x-1.x authored by webflo
    Issue #2133627 by webflo, hass: Merge some code from the sandbox
    

  • hass committed d687cf2 on 8.x-1.x
    Issue #2133627 by hass: hook_field_extra_fields() was renamed to...

  • hass committed 13064d3 on 8.x-1.x
    Issue #2133627 by hass: Upgrade deprecated code
    

  • hass committed 01edfc6 on 8.x-1.x
    Issue #2133627 by hass: Per changelog 2294409 no code changes needed
    

  • hass committed 86e94ef on 8.x-1.x
    Issue #2133627 by hass: Bullshit - the params have changed
    

  • hass committed 3fa26ec on 8.x-1.x
    Issue #2133627 by hass: Upgrade hook_ENTITY_TYPE_*
    

  • hass committed f3d5669 on 8.x-1.x
    Issue #2133627 by hass: Fix menu and tab
    

  • hass committed b2acb2a on 8.x-1.x
    Issue #2133627 by hass: Quote tab title with spaces
    

  • hass committed 89338ab on 8.x-1.x
    Issue #2133627 by hass: Disable real name field by default in display
    
hass’s picture

hass’s picture

hass’s picture

  • hass committed 3183b1c on 8.x-1.x
    Issue #2133627 by hass: Clear render cache to update the display-name's...

  • hass committed 00b5922 on 8.x-1.x
    Issue #2133627 by hass: Clear render cache to update the display-name's...
hass’s picture

hass’s picture

hass’s picture

Ronald van Belzen’s picture

My apology when this is not the proper place. But I noticed, what I think is an error in the code of realname.module that seems easy to mend.

/**
 * Implements hook_ENTITY_TYPE_update().
 */
function realname_user_update(Drupal\Core\Entity\EntityInterface $account) {
  // Since user data may have changed, update the realname and its cache.
  $realnames = &drupal_static('realname_load_multiple', array());
  //$realnames[$account->id()] = realname_update($account->id()); /* Causes an error */
  $realnames[$account->id()] = realname_update($account);
}

The error according to the log was:
TypeError: Argument 1 passed to realname_update() must be an instance of Drupal\user\Entity\User, string given, called in C:\...\wwwroot\modules\realname\realname.module on line 110 in realname_update() (line 289 of C:\...\wwwroot\modules\realname\realname.module).

grahl’s picture

The 8.x-1.x branch seems to work relatively well, could this branch be set as supported so installing with composer is easily possible? Thanks!

hass’s picture

No, it is not working properly. Please help getting the core issue RTBC and the open todo's fixed.

grahl’s picture

Issue summary: View changes

Waiting for the core issue to be committed before providing access to the development branch for a minor display issue is unreasonable from my perspective. It might block a stable release or maybe even a beta release but with the fixes now in the issue queue the module is at the very least a usable dev-branch.

hass’s picture

The core issue is not a blocker. The module has errors and I asked for help, but until now, nobody tried to help.

hass’s picture

  • hass committed bc398cd on 8.x-1.x
    Issue #2133627 by hass: Save user after name change
    

  • hass committed 5984ccd on 8.x-1.x
    Issue #2133627 by hass: Note why these tests are currently failing
    

  • hass committed 91b38fe on 8.x-1.x
    Issue #2133627 by hass: Add more test coverage / fix test
    

  • hass committed 9f72529 on 8.x-1.x
    Issue #2133627 by hass: Migrate to hook_ENTITY_TYPE_view and migrate l()
    

  • hass committed 3a4d69c on 8.x-1.x
    Issue #2133627 by hass: Typo in assert type
    

  • hass committed 599a295 on 8.x-1.x
    Issue #2133627 by hass: Remove profile2 integration. Should fire with...
hass’s picture

hass’s picture

Status: Needs work » Fixed
tormi’s picture

@hass & Co, great work! But there's no tagged release yet, maybe keep this open until that?

Status: Fixed » Closed (fixed)

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