Problem/Motivation

It is possible to use callables (in my case array('ClassName', 'staticMethod')) for #element_validate in drupal core to define elements in hook_element_info(). This doesn't work with Webform though, as it checks it with is_function().

Proposed resolution

Just replace is_function with is_callable as was done in Drupal 7.50 in many places.

Remaining tasks

Please review if this makes sense.

Comments

kanei created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, Allow_element_validate_to_be_a_callable.patch, failed testing.

mvantuch’s picture

Status: Needs work » Needs review
StatusFileSize
new677 bytes

Status: Needs review » Needs work

The last submitted patch, 3: Allow_element_validate_to_be_a_callable.patch, failed testing.

mvantuch’s picture

Status: Needs work » Needs review
StatusFileSize
new848 bytes

  • DanChadwick committed 0a4658c on 7.x-4.x
    Issue #2768023 by kanei, DanChadwick: Fixed allow #element_validate and...
danchadwick’s picture

Status: Needs review » Fixed
StatusFileSize
new1.52 KB

Seems reasonable. I found another case in select components where the options_callback might be an array if altered by drupal_alter.

This is a blind, untested commit, since I don't have the resources to set up callables to test this.

Committed to 7.x-4.x

danchadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Category: Feature request » Task
Status: Fixed » Patch (to be ported)
fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Category: Task » Feature request
Status: Patch (to be ported) » Fixed

Closing to clear out the old Webform 8.x-4.x branch. See #2827845: [roadmap] YAML Form 8.x-1.x to Webform 8.x-5.x.

  • DanChadwick committed 0a4658c on 8.x-5.x
    Issue #2768023 by kanei, DanChadwick: Fixed allow #element_validate and...

Status: Fixed » Closed (fixed)

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