Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've got a pretty serious rewrite. I'm putting this into a new issue because I don't want to derail an existing issue. Patch forthcoming.
This is a follow-up form #1630820: entity_field_value is completely broken
Comment | File | Size | Author |
---|---|---|---|
#30 | entity_field_value_broken_alternative-1955954-30.patch | 13.67 KB | droath |
#1 | 1955954-entity-field-value-broken.patch | 13.7 KB | merlinofchaos |
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedThis is a pretty serious rewrite. I had to make use of entity_field_value.inc for a project, and I found it fell very short of the mark of being useful.
This patch is still flawed, but it at least gets it to usability with basic fields: int, text, list, date. It doesn't do anything with file fields right now, and it's completely broken with field_collection. It does seem to work with at least one entityreference field, but that's dependent entirely upon how the entityreference widget is set up. I do believe it should, in fact, mostly work with reference fields in general.
Some of the problems I identified:
1) It used a nearly nonsensical method to set #default_values on the form that it used and it broke on date fields.
2) It used a totally nonsensical method to extract the values from the resulting form, and then made extra copies of them for no apparent effect.
3) The summary provided no information at all.
4) No operators meant limited utility in general. Exact match is fine for checkboxes but that's just about it.
Flaws of note:
1) List support is hardcoded; it seems like there should be a set of hooks that could be used to let field types extend this.
2) Fields mentioned above will be broken.
Comment #2
mcfilms CreditAttribution: mcfilms commentedWhat is the best course of action if someone is getting the Undefined index: field_image_fid in ctools_entity_field_value_ctools_access_summary() errors? (As well as similar ones for width, alt, etc.)
I didn't realize entity fields were mostly useless and was using them on my panels page. Now I cannot edit or save my panels page without an error. Is this patch the best fix?
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedYes. Dependent upon when I get time to do it, this patch or a future variant of it will get committed.
Comment #4
mcfilms CreditAttribution: mcfilms commentedAfter applying this patch I am now prevented from editing my panel page. However I am getting two errors:
Notice: Undefined index: field_image in ctools_entity_field_value_ctools_access_summary() (line 271 of /home/dte/public_html/sites/all/modules/ctools/plugins/access/entity_field_value.inc).
Notice: Trying to get property of non-object in ctools_entity_field_value_ctools_access_summary() (line 300 of /home/dte/public_html/sites/all/modules/ctools/plugins/access/entity_field_value.inc).
Comment #5
mcfilms CreditAttribution: mcfilms commentedLines 269 to 304 of entity_field_value.inc look like this:
Comment #6
merlinofchaos CreditAttribution: merlinofchaos commentedBased on #4, I'm going to guess that this system isn't really compatible with the format used for images.
What exactly are you trying to do in a comparison plugin with images? There's not really much to compare.
Comment #7
andypostnew patch in #1630820-53: entity_field_value is completely broken
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedPlease note that I'm using this patch on a site and I'm pretty confident in it; I'd been hoping for more feedback from people, but alas.
Further work on that other patch is probably not going to go anywhere, as this will entirely supercedei t.
Comment #9
maximpodorov CreditAttribution: maximpodorov commentedI'd recommend to have two distinct plugins, since they are of different purposes. For example, you can't compare fields having multiple properties by any operator but equivalence. entity_field_value with the last patch from http://drupal.org/node/1630820 supports such fields. Even field collections can be supported in the future.
Comment #10
mcfilms CreditAttribution: mcfilms commented@merlinofchaos - It is entirely possible I was "doing it wrong" when I broke my site. I had a content type made up of images and I was creating a views slideshow based on taxonomy terms. Then I was putting this slideshow in a panel by using a relationship. If you really want to see it I can send you a clone of the site or the database.
Meanwhile, it seems you are both closing in on a fix from two different directions. It'd be nice if we could get the best of both. Any chance of a collaboration?
As I posted in that other thread, I think it would nice nice to see a "Known Issue" warning on the cTools module page stating that there is a current bug with evaluating conditional fields that causes problems with the Relationship module and/or autocomplete Taxonomy fields.
Comment #11
merlinofchaos CreditAttribution: merlinofchaos commentedYes, I absolutely want to collaborate and I think that if there are things that other patch is doing that this one is not, we should get them together and have tea.
Comment #12
Alpinist1974 CreditAttribution: Alpinist1974 commented@merlinofchaos
Hi,
Re #11, I was just wondering if there are still plans to fix/commit the entity fields/access/selection rules plugin issue? I'd really love to be able to use this in my current project. I've tried all of the patches and nothing seems to work for me. CTools and Panels are superb modules, I just wish they'd play nice with entity.
Thanks!
Matt
Comment #13
maximpodorov CreditAttribution: maximpodorov commented@Alpinist1974, do you confirm http://drupal.org/node/1630820#comment-7419790 does not work for you?
Comment #14
Alpinist1974 CreditAttribution: Alpinist1974 commentedConfirmed; this patch does NOT work for me. While I can see the saved value of the field in the Description box (could not previously), I now receive this message:
Notice: Undefined index: #parents in field_default_form() (line 49 of C:\wamp\www\lc2030\modules\field\field.form.inc).
Moreover, the behavior is the same: The access test still fails when it should pass, i.e., the field value is present in the user form and seems to be present in the access field, yet access is still not granted.
Thanks,
Matt
Comment #15
merlinofchaos CreditAttribution: merlinofchaos commentedYes, I completely intend to commit the patch in this issue, preferably merged to fix other issues.
If the patch in this issue doesn't work for you, I'll need specifics to address it.
Comment #16
Alpinist1974 CreditAttribution: Alpinist1974 commentedGreat, thanks! I provided some details in #14 of this issue. Let me see if I can find anything else that might be useful.
Comment #17
merlinofchaos CreditAttribution: merlinofchaos commentedFor #14: What type of field is it, and exactly how are you configuring it?
Comment #18
Alpinist1974 CreditAttribution: Alpinist1974 commentedThe field is a taxonomy term reference, used in a select list, configured in a Profile2 field.
I have gotten the same results, however, using ordinary text fields and hierarchical select term reference fields, all from within Profile2.
Comment #19
merlinofchaos CreditAttribution: merlinofchaos commentedOdd. I'm using this just fine with ordinary text fields. I've never tested it with a term reference. I wonder what the difference is. Well, I'm not using profile2; that could be a difference I suppose, but I shouldn't think it would make a difference.
Comment #20
Alpinist1974 CreditAttribution: Alpinist1974 commentedI double checked the text fields and they still don't work, when passed in as user fields through entity.
Also, this problem doesn't seem to be limited to access--I can't use any of these values either as selection criteria either.
Here are some warnings I get:
Warning: implode() [function.implode]: Invalid arguments passed in field_multiple_value_form() (line 199 of C:\wamp\www\lc2030\modules\field\field.form.inc).
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in field_multiple_value_form() (line 199 of C:\wamp\www\lc2030\modules\field\field.form.inc).
I'm fairly new to CTools/Panels, but I don't think I'm doing anything wrong here. I really love the concept of per page variants, and I'm trying to leverage this in a complex troubleshooting algorithm, that will show/hide page content based on taxonomy terms passed in through a configuration page, in the user's profile. Hence the need to use Profile2 and access and selection rules.
Comment #21
andypostSuppose better to split patches:
- current should operate as is + patch #1630820: entity_field_value is completely broken
- new one build on top of that issue with extended operation to compare (just for text fields)
Actually support for different cardinality should live in first one
Comment #22
maximpodorov CreditAttribution: maximpodorov commented@Alpinist1974, integration between ctools and Profile2 is known to be broken. Could you try http://drupal.org/node/1630820#comment-7419790 in any other case?
Comment #23
Alpinist1974 CreditAttribution: Alpinist1974 commented@maximpodorov
I am currently using this patch and it doesn't seem to work.
Thanks for the heads up about Profile2 and Panels. Guess I'll check the issue queue there.
Comment #24
Alpinist1974 CreditAttribution: Alpinist1974 commented@andypost
I tried using the dev version of Profile2 and still no luck. I see you wrote a patch:
https://drupal.org/node/1011370#comment-6884220
Was this committed to dev? If not, do you think it might work here?
Thanks!
Comment #25
jhodgdonmerlinofchaos pointed me at this issue from
#2022677: Taxonomy term selection rule is not displayed properly in Panels Page
I tested this with a taxonomy term reference, and the Summary is still broken -- see comment #2 on that other issue.
Comment #25.0
jhodgdonUpdated issue summary.
Comment #26
andypostSo the solution for the issues should care about already configured values, and then I think better to use some glue code to make a equal and extended settings splitter
@Alpinist1974 the profile2 related issue is #1011370: Ctools relationship from user
You need 2 patches to solve your case
Comment #27
ceepeebee CreditAttribution: ceepeebee commentedI had a problem with selection rules on a page variant (test on emptiness of a date field). (ctools 7.x-1.3+4-dev, page manager 7.x-1.3+4-dev both included with Drupal Commons 3.4)
This patch #1 worked for me very well.
I tried patch #58 submitted on #1630820: entity_field_value is completely broken as well. While it did get rid of the errors/notices, it didn't solve my problem, because it doesn't allow the comparisons I needed.
Many thanks to merlinofchaos for making this possible.
How can I help to test this patch thoroughly?
Are there any intentions to merge the patches?
Comment #28
DamienMcKenna@ceepeebee: I think we need thorough testing and full documentation on what works & doesn't work for both this and #1630820.
Comment #29
busla CreditAttribution: busla commentedI guess I should report aswell.
I´m getting these messages when using a taxonomy term field on a node as a selection rule in my panel.
Notice: Undefined index: #parents in field_default_form() (line 49 of /Applications/MAMP/htdocs/mysite/modules/field/field.form.inc). =>
Notice: Undefined index: field_post_category_tid in ctools_entity_field_value_ctools_access_settings() (line 112 of /Applications/MAMP/htdocs/mysite/profiles/myprofile/modules/contrib/ctools/plugins/access/entity_field_value.inc). =>
Comment #30
droath CreditAttribution: droath commentedI guess I should have checked the issue queue before rewriting the entity_field_value.inc access plugin again. Lesson learned! :)
I took a brief look at the existing patch and from what I can tell I'm using a different approach. So I thought I'll post my patch here as well, as it might help solve some other issues.
Comment #31
maximpodorov CreditAttribution: maximpodorov commentedWhy do you ignore the working solution: https://drupal.org/node/1630820#comment-7745811 ? :)
Comment #36
osopolarComing from #1962124: Visibility rules failing for non textareas fields I wonder what it needs to get visibility rules work for example for entity reference field. Is work on this issue still valid, as #1630820: entity_field_value is completely broken got fixed or do we have to start from zero?
Comment #37
andypost