Closed (fixed)
Project:
Reference field option limit
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Jun 2022 at 13:34 UTC
Updated:
12 Dec 2022 at 19:43 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
joachim commentedIt's not something I have time to work on myself, but happy to look at a patch :)
Comment #3
WebbehComment #4
russellb commentedComment #5
WebbehGiven #4, for review?
Comment #6
russellb commentedComment #7
russellb commentedI'm not sure what's going on with this profile2 test failing. This is working for me. I've deployed this fix to a fairly busy site, I'll report back when it's been live for a bit.
Comment #8
russellb commentedI found another one in testing.
Comment #9
joachim commentedCode comments shouldn't refer to fixed bugs. There is no point in code being a historical record, it should describe itself as it is now. For the history, there is git.
In what cases is this not an array?
It got set with:
$values_field_matching = field_get_items($entity_type, $entity, $field_name_matching);
Why would that be NULL?
false should be in caps.
Don't do single-line ifs; use {}.
Also, could the whole of this be done with the ?? operator instead?
Comment #10
russellb commentedre 2. - in this case I am seeing $values_field_matching FALSE when field_get_items doesn't find any items.
Comment #11
russellb commentedI have actioned code style requests 1. 3. & 4. in the new patch above #10.
Many thanks,
Russell
Comment #12
russellb commentedI've had #10 running on a live site for a while now.
Looks good.
Comment #13
joachim commented> in this case I am seeing $values_field_matching FALSE when field_get_items doesn't find any items
Ah yes, I've checked the docs. (Weird choice to not have it return [] so it can always be iterated over!)
Could you do this with $required = $element_limited[LANGUAGE_NONE]['#required'] ?? FALSE; instead?
Comment #14
russellb commentedYes I guess we don't need to support 5.6 any more. I'll re-roll with ??
Comment #15
russellb commentedRe-rolled with ?? FALSE
Comment #17
joachim commentedThanks!
I'll make a new release.
Comment #19
solideogloria commentedCould we get a commit of the fix in #3011848: PHP 7.2: Parameter must be an array or an object that implements Countable? It's also needed for PHP compatibility, as of PHP 7.2