Improve api consistency on custom field creation
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 1 Jul 2021 05:50:57 +0000 (17:50 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 4 Jul 2021 01:03:56 +0000 (13:03 +1200)
commit9ccfced437e90c3383a3ad70791e63aeb4ecb530
treea550424a3c0f8ca5ce22d13df3b45ce66b60bc0e
parent02ef1a69ca22ff6d12b2fef9d856669bce1fed55
Improve api consistency on custom field creation

Api supports a key 'option_values' by always setting the 'magic' param
option_type to 1. v4 doesn't - but creating option values when creating
a custom field is desirable. This fixes so that the form still
'opts out' if it passes in '2' but otherwise we create the option values
if passed in.

Just a teensy bit less magic in the api layer & bao
CRM/Core/BAO/CustomField.php
Civi/Test/Api3TestTrait.php
api/v3/CustomField.php
tests/phpunit/api/v3/CustomFieldTest.php