Right now when creating a new update the user has to pick a value for the field or fields on an update.

This is fine for many situations but for very common cases like scheduling a publish date the site builder may not want the user to be given a choice about the value of "Publish Status"

They may want the user to just to see a date field labeled "Publish On".

This possible now with the module if:
The default value of "Publish Status" on the Scheduled Update Type is checked.
The field is hidden on form display

Of course that is hard to figure out with documentation.

I will try to make an option to provide a default value on the Scheduled Update Type form if the user is selecting a field there(instead of cloning multiple fields)

Comments

tedbow created an issue. See original summary.

tedbow’s picture

.

  • tedbow committed 1040e20 on 8.x-1-default_value-2655076
    Issue #2655076: create default widget for allowed types"
    
  • tedbow committed 10a5b41 on 8.x-1-default_value-2655076
    Issue #2655076: Save default values and with hide option.
    
tedbow’s picture

Status: Active » Needs work

I have this mostly working in the branch. Can make patch if needed or anyone else can make patch from the branch.

Mostly working but hardcoded for bundle if not coming from "add update field" link.

  • tedbow committed 93eb2d6 on 8.x-1-default_value-2655076
    Issue #2655076 by tedbow: Special case for entity reference default...

  • tedbow committed bd04a52 on 8.x-1-default_value-2655076
    Issue #2655076 by tedbow: Form settings title and only override widget...

  • tedbow committed d8ad152 on 8.x-1-default_value-2655076
    Issue #2655076 by tedbow: Finished getDefaultBundle function to use in...
tedbow’s picture

Issue tags: +Needs tests

ok. I have this working now.

Right for now I am limiting the default value widget option to boolean fields, lists and entity reference that target Config entities.

I think for other entities references you could have the problem of exportable Config Entity, Scheduled update Type, referencing a non-exportable entity. This would probably cause deploy headaches. Of course a sitebuilder can do whatever they want on the manage fields page. But that is up to them.

Tagging as needs tests.

  • tedbow committed cdeceb8 on 8.x-1-default_value-2655076
    Issue #2655076 by tedbow: Added tests for adding default values and...
tedbow’s picture

Assigned: tedbow » Unassigned
Status: Needs work » Closed (fixed)
Issue tags: -Needs tests
welly’s picture

Status: Closed (fixed) » Needs work

There is an issue opened at https://www.drupal.org/node/2693849 which is related to this. It appears the hide field option is broken. More info on that issue.

smustgrave’s picture

Status: Needs work » Closed (outdated)

Will check in the related issue.

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.