When controlled field is Title and Target field is text field and set to required than I see the below issue.
Error: Call to a member function getCardinality() on null in conditional_fields_get_state() (line 216 of /Users/sites/drupal/modules/contrib/conditional_fields/conditional_fields.api.inc) #0 /Users/sites/drupal/modules/contrib/conditional_fields/conditional_fields.api.inc(85): conditional_fields_get_state(Object(Drupal\Core\Entity\Entity\EntityFormDisplay), 'title', Array, Array) #1 [internal function]: conditional_fields_form_after_build(Array, Object(Drupal\Core\Form\FormState)) #2 /Users/sites/drupal/core/lib/Drupal/Core/Form/FormBuilder.php(1064)
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | error_call_to_a_member-2921741-9.patch | 10.17 KB | gg24 |
| #7 | Before.png | 27.37 KB | riddhi.addweb |
| #7 | After.png | 65.6 KB | riddhi.addweb |
Comments
Comment #2
gg24 commentedPlease review the attached patch.
Thanks!
Comment #3
gg24 commentedThis patch will work for 8.x-1.0-alpha2 version.
Thanks!
Comment #4
gg24 commentedComment #5
gg24 commentedThis patch will work for 8.x-1.x-dev version.
Thanks!
Comment #6
guptahemant commentedhi @gg24,
Tested both of your patches in #3 and #5 and both are working fine marking the issue as RTBC.
Comment #7
riddhi.addweb commented@gg24, Thanks for the patch it works well, as i checked it over simplytest.me PFA screenshots as results of after patch & before patch.
Also, Thanks for explaining the case, it helps me to reach the issue easily.
Comment #8
colanThis comment isn't necessary as it's obvious from the code in the line below.
There's a missing space after the
if, and the enclosing brackets are missing. Please review the coding standards.Comment #9
gg24 commentedHi @colan,
I made the changes suggested and corrected syntax issues in the respective file too.
Please review.
Thanks!
Comment #10
colanAll of the array stuff is done in #2881629: Convert module to use short array syntax (new coding standard).. Let's just focus on the main issue here so as not to confuse things.
Comment #12
colanCommitted a cleaner variation of the above patch so that we could get this in sooner than later.