Problem/Motivation

See parent issue.

Proposed resolution

Remaining tasks

User interface changes

API changes

Comments

tim.plunkett’s picture

Status: Active » Needs review
StatusFileSize
new62.93 KB

Status: Needs review » Needs work

The last submitted patch, 1: datetime-2325049-1.patch, failed testing.

sun’s picture

Looks great — some early feedback:

  1. +++ b/core/modules/datetime/src/Element/Datelist.php
    @@ -0,0 +1,361 @@
    +  public static function validateDatelist(&$element, FormStateInterface $form_state, &$complete_form) {
    
    +++ b/core/modules/datetime/src/Element/Datetime.php
    @@ -0,0 +1,432 @@
    +  public static function validateDatetime(&$element, FormStateInterface $form_state, &$complete_form) {
    

    Any particular reason for using different method names?

    Why don't we consistently use validate()?

  2. +++ b/core/modules/datetime/src/Element/Datetime.php
    @@ -0,0 +1,432 @@
    +  public static function processDatetime(&$element, FormStateInterface $form_state, &$complete_form) {
    

    Can we always locate process() above validate(), so that the methods on the element classes are declared in the order in which they are invoked?

    getInfo()
    valueCallback()
    process()
    afterBuild()
    validate()
    preRender()
    postRender()
    

    Also, as above, ditto for processDateTime()process()

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new63.15 KB
new19.01 KB

They were originally called datetime_datetime_validate and datetime_datelist_validate. And who knows what other #element_validate might exist in the future. So not renaming those just yet.

The interdiff looks REALLY messy because git is trying to match { and } or something, when I'm really just moving the methods.

Also fixed the base class.

Status: Needs review » Needs work

The last submitted patch, 4: datetime-2325049-4.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new504 bytes
new63.05 KB

Wow, that was an unfortunate copy/paste. '#maxlength' completely breaks datetime.

Status: Needs review » Needs work

The last submitted patch, 6: datetime-2325049-6.patch, failed testing.

tim.plunkett’s picture

See #2328061: Move datetime's FormElement #type classes in Core, if we decide to go that route this is a dupe.

tim.plunkett’s picture

Status: Needs work » Closed (duplicate)