I'm updating my module user-tabs, which puts the edit tab and other user_categories underneath the default user view tab, thus making room for other modules to add user tabs.
However I can't find any equivalent of user_categories in d8.
Can I be pointed in the right direction?

Comments

matslats’s picture

Component: user system » field system
Category: Support request » Feature request

I have worked out a cumbersome way to do what hook_user_categories did, i.e. divide the user profile into several pages (at least for editing).
1. Create a new form_modes on the user entity /admin/structure/display-modes/form/add/user
2. Edit the field visible in each form mode /admin/config/people/accounts/form-display
3. implement hook_entity_type_alter thus:$entity_types['user']->setFormClass('CATEGORY', "Drupal\user\ProfileForm");
4. Declare new routes in mymod.routing.yml thus:

entity.user.editform_CATEGORY:
  path: '/user/{user}/CATEGORY'
  defaults:
    _entity_form: user.CATEGORY
    _title: WHATEVER
  requirements:
    _entity_access: user.update

5. Declare tabs for the above routes.
This procedure should be officially, documented. Further, since user_categories seems to be deprecated and this method rather different, I suggest the above be added to core, with the entity altering and menu items (and tasks) being created automatically optionally when the form mode is created. This would leave the user only to customise which fields go in which tabs.
The alternative I think would involve something like the content_profile module or maybe page_manager? Both of these would be overkill
Another helpful innovation would be to incorporate the usertabs module into this OR upgrade that module to offer this functionality. It puts the addition user_category edit tabs UNDER user/x/edit

cilefen’s picture

This is the change record mentioning the removal: https://www.drupal.org/node/1393236

matslats’s picture

Well done for digging up that reference.
More information about why it was removed and what might replace it would be useful too.

matslats’s picture

The replacement is quite great.
Just as each bundle has view modes it now has form modes
Each mode can have a different range of fields display.
It could be a bit easier I think - I still had to manually create the route and tell the entity there is a new form.

function MY_MODULE_entity_type_alter(array &$entity_types) {
  $entity_types['user']->setFormClass('NEWMODE', "Drupal\user\ProfileForm");
}

Then created a new route for it in MY_MODULE.routing.yml

entity.user.NEWMODE:
  path: '/user/{user}/edit/NEWMODE'
  defaults:
    _entity_form: user.NEWMODE
    _title: Edit NEW MODE
  requirements:
    _entity_access: user.update

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

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Category: Feature request » Support request
Status: Active » Fixed

The Change record pointed to by cilefen in #2 explains the change and matslats is using that information successfully.

Changing to a support request because the feature is still there just need to know where to find it. And closing as fixed.

Thanks!

Status: Fixed » Closed (fixed)

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