Problem/Motivation

When checking a role that has user role expiration enabled, the expiration form field appears with its description.

It would be nice to have it less prominent and space-consuming, as setting an expiration is not a key functionality in most cases.

Steps to reproduce

See above

Proposed resolution

  1. Wrap the field into a closed details field group (only exposed if an expiration date is present)
  2. Add a setting for the default in the global module settings, having "collapsed" by default
  3. If possible, place it beside the roles (but I think this will be hard with Drupal's minimal default CSS classes available) or needs custom CSS

Remaining tasks

  1. Discuss
  2. Implement
  3. Test
  4. Release

User interface changes

See above

API changes

None

Data model changes

Additional setting for the default details fieldset style

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anybody created an issue. See original summary.

greggles’s picture

Can you post a screenshot of the problem area? I want to be sure I understand the functionality you're describing.

anybody’s picture

Issue summary: View changes
StatusFileSize
new121.46 KB

Thanks @greggles yes of course!

Here it is:

It would be great if this could be more compact or collapsed, as long as unused, see proposed solutions above.

greggles’s picture

I think those fields might be in https://www.drupal.org/project/role_expire ?

anybody’s picture

Project: User Expire » Role Expire

Oh **** @greggles SORRY, I glitched into the wrong module indeed! I'll move it over, sorry!! Thank you!

kuzyawkk’s picture

Version: 8.x-1.x-dev » 4.x-dev
Assigned: Unassigned » kuzyawkk

kuzyawkk’s picture

Assigned: kuzyawkk » Unassigned
Status: Active » Needs review
anybody’s picture

@kuzyawkk thanks! Could you post a screenshot of the result maybe?

kuzyawkk’s picture

StatusFileSize
new69.46 KB
new94.97 KB

Hi @anybody, welcome. Yeah, I'm attaching screenshots with the result
Role Expire Checkbox
Role Expire Details

anybody’s picture

I left some comments on the MR @kuzyawkk.
Maybe @rcondina would be so friendly to also take a maintainer look for feedback?

anybody’s picture

Status: Needs review » Needs work

rcodina made their first commit to this issue’s fork.

rcodina’s picture

Status: Needs work » Needs review
StatusFileSize
new65.36 KB
new47.24 KB

New configuration option:
Image field settings after patch

New collapsible help:
Image field settings after patch

rcodina’s picture

anybody’s picture

Thanks @rcodina GREAT WORK!

Not all help option messages are the same

Sorry I didn't see that.

I'll review the results now!

anybody’s picture

Status: Needs review » Reviewed & tested by the community

GREAT @rcodina! RTBC.

Testing this out took the idea even one step further, and I think it might make sense:
As long as there's no expiration date set for a role, we could even put the expiration field into the details and make the title "Role expire" or "Role expiration". If a value is set or the global option is disabled, the fieldset should be #open, otherwise closed.

That would make it even more compact and I think helpful! :)
What do you think?

anybody’s picture

PS: It might also make sense to add an indicator to the details title regarding the status ("No expiration" / "Expiration: XXX"). I think that would really be perfect then!

PPS: We might even keep it closed, when filled, using the title solution...

anybody’s picture

Status: Reviewed & tested by the community » Needs work

Setting this back to NW for the suggestions, what do you think? I think it's worth it...

rcodina’s picture

StatusFileSize
new30.99 KB
new45.6 KB

New configuration option:
Image field settings after patch

New collapsible help (collapsed):
Image field settings after patch

New collapsible help (expanded):
Image field settings after patch

rcodina’s picture

Status: Needs work » Needs review

@anybody Such a great idea! Could you please review it? Once done, I think it should be collapsed by default!

rcodina’s picture

StatusFileSize
new105.92 KB
anybody’s picture

Thanks @rcodina sorry I didn't come to that conclusion earlier and thank you for the great implementation, review in progress!

anybody’s picture

Status: Needs review » Needs work

Great work, just some minor comments.

Any I think it makes sense to add an update hook setting
role_expire_expiration_field_visibility explicitly.

I'd vote to set it TRUE by default, even if it's kind of breaking change, it's not end-user related and it improves the UI / UX in the backend, so I think the majority would like to have this.

The update hook description should inform the users about the new feature and that they can disable it, if they would like to keep the old, expanded style?

REALLY AWESOME WORK!!

rcodina’s picture

Status: Needs work » Needs review

@anybody I think the new option "Expand role expiration fields by default" should be FALSE by default because it's much better. However, I agree for current module users we need an update hook to set it TRUE (cause they are used to expanded style). You agree?

anybody’s picture

Yes, sorry if I wrote it the wrong way around. The new UI is much better for all!

anybody’s picture

Status: Needs review » Needs work
rcodina’s picture

Status: Needs work » Needs review
anybody’s picture

Status: Needs review » Reviewed & tested by the community

@rcodina Super nice!

Just saw you decided to keep it open for existing installations:

/**
 * Automatically enable expanded role expiration details option.
 */
function role_expire_update_10002(&$sandbox) {
  \Drupal::configFactory()->getEditable('role_expire.config')->set('role_expire_expiration_details_expanded', TRUE)->save();
}

Is it for BC reasons?

While I'd vote to also collapse it for existing installations. I'd at least suggest changing the description a bit to inform updaters. The function description is shown in update.php and when running drush updb so maybe we should write something like:

Added new setting to expand / collapse the role expiration details in the user profile form. Setting default value: XXX. You can change the value on the role_expire settings page

RTBC anyway, feel free to decide which text you'd like to use.

Thank you so much for this great improvement!

rcodina’s picture

@anybody With the suggested text, I think it's better to turn it FALSE by default for existing installs. Thanks all!

anybody’s picture

@rcodina yes I'm fine with that! :)

Let's go!

anybody’s picture

@rcodina any plans to merge this and maybe tag a new release?

  • rcodina committed 69eafa5a on 4.x authored by kuzyawkk
    Issue #3463811 by rcodina, kuzyawkk, anybody: Make the user expiration...
rcodina’s picture

Status: Reviewed & tested by the community » Fixed
rcodina’s picture

Status: Fixed » Closed (fixed)

Included in new 4.1.0 release.

anybody’s picture

Thank you very very much @rcodina!! :)

PS FYI: You don't have to set Closed (fixed) manually, Drupal.org will do that automatically after some weeks passed, if you just set it "Fixed". That's best practice.