After working with this module, and figuring out a workflow for page approvals on a project im working on. I got a request that it would be nice to have an option to create a custom lifetime for the access token, on both the configuration page and on the node edit form.

My thought is that when the module is enabled, you still have all of the current lifetime options in the dropdown, with an additional "custom" selection. When that is selected, a text input field shows up below the dropdown that allows the user to input in a custom hour value. Or it could be more specific to allow the user to input the day, hour, and second fields. Then when you save, the module calculates the duration of the custom values, and saves that duration value in seconds like the rest of the lifetime options.

I'm working on this on my free time, and will post a patch when I have something close to this functionality.

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

c_c created an issue. See original summary.

c_c’s picture

Issue summary: View changes
Cecilina’s picture

Create a patch only for entity form alert part using custom option.

Cecilina’s picture

Fix coding standard else if to elseif

generalredneck’s picture

Status: Active » Needs review
generalredneck’s picture

@mably,

I forgot that this issue was laying around. It's very similar to you hook in #3559355: Add an alter hook to allow customization of the duration options.

I wonder if we should support both. The hook makes for an easy set of ready used options... but this one would allow for those one off instances where someone needs longer times?

mably’s picture

We could add a 'custom expiration' entry in the options list.

And when the 'custom expiration' entry is selected, we display an input field allowing to enter a custom expiration value.

EDIT: Ok, looks like it's what is suggested in the patch. Will create an MR.

It’s still useful to have the hook if we want to be able to disable this feature (which we will).

mably’s picture

MR created. Functional Javascript test added.

  • mably committed 88bffabf on 8.x-1.x
    feat: #2942249 Add option to provide a custom lifetime for the access...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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