Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
fieldapi data
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Nov 2009 at 10:17 UTC
Updated:
9 Jan 2011 at 20:25 UTC
Jump to comment: Most recent file
Comments
Comment #1
xslim commentedAre there some tutorials of porting CCK usage to Fields API?
Comment #2
dawehnerDo you mean the views integration part?
If not you have for example http://drupal.org/node/443540
Comment #3
xslim commentedWell I want to add to Views ability to show custom fields in D7 but I don't know from where to start
Comment #4
chx commentedComment #5
damien tournoud commentedThis is a very first shot at that.
This patches exposes data for fields using the field_sql_storage engine, and link them to the base tables of all the entities using the fields. It should be enough to build simple views.
What's missing:
* Implement the custom handlers (content_multiple_handler, especially)
* Implement "link to the entity" in a generic way (not sure we have everything we need to do that right now)
* Figure out how to get a label for the field (labels are attached to the instance, not to the field, so there is no way to use that to display a prettiest and more usable description for the field)
Note: you might need to apply #645990: Fix handling of 'extra' conditions and left/inner joins first.
Comment #6
yched commentedWay cool.
FYI: when it comes to displaying the field values, you'll probably bump into field_format() and #612894: field_format() is just a pile of code that doesn't work
Comment #7
yched commentedSee #525622: 'as link' formatters need a generic way to build the url of an 'entity'
Yup. No real workaround for this, other than taking the label from a random instance of the field. People like the 'Label as instance-level property' feature...
Comment #8
xslim commentedDamien, Can you provide a simple view using your api for testing?
Comment #9
vgarvardt commented* subscribing
Comment #10
Magnity commentedI'm currently running using this patch, and it seems ok so far. Will report any errors if or when.
Successfully added a field to a view, and also filtered by that field.
Comment #11
backwardgraphics commentedSubscribing
Comment #12
dawehnerSome start for multiple values. The documentation for fieldapi is not the best.
Comment #13
Shai commentedThanks folks... I actually had Views up and running on a D7 Sandbox site I've just built that allows people to play with D7 (http://d7sandbox.net), but my use-case really required access to by views to fields I had added... so not currently using it at the moment. But once you all get a patch in, I'll test it hard on a live site.
Shai
Comment #14
dawehnerI wouldn't use my patch. DamZ did quite some stuff on github.h
Comment #15
yched commentedHm. $entity_info['object keys']['id'] is the name of the 'id' property in a loaded $object. In most cases, it will happen to be the same as the actual column name in the base table, but it's not a rule.
Not sure that information is available somewhere. Perhaps in the exposed data about the base table ?
Typo - field_defintion
Similarly,
$this->view->base_tablehappens to match the name of the entity type in good cases, but that's not a rule.Powered by Dreditor.
Comment #16
yched commentedAdditionally:
Also needs to join on
'deleted' = 0.Field API has a delayed deletion mechanism to avoid timeouts on large deletes (i.e 'node type delete' = potentially 10s of 'field instance delete'). Views should overlook any Field data with 'deleted = 1'.
Powered by Dreditor.
Comment #17
merlinofchaos commentedJust an FYI -- this patch is the blocker on getting an alpha release out. I think we can go with any number of horribly broken features, but Views has minimal value without field.module integration.
Any effort people want to spend on Views for D7 should be spent here, first and foremost, at this point, especially since we know that we can get reviews from yched.
Is anyone actively taking this patch forward?
Comment #18
dawehnerhere is jst the patch from damzs repo
Comment #19
jphautin commentedgreat job ! Work fine on my drupal 7 alpha1 platform.
Comment #20
willmoy commentedsub
Comment #21
damien tournoud commentedHere are some progress in that path. We now have configurable formatters. Sadly, core display function is still broken (see #612894: field_format() is just a pile of code that doesn't work).
Comment #22
damien tournoud commentedThis one actually works! It seems that field_view_field() actually does what we want here, we just need to forcefully set
'label' => 'hidden'.Comment #23
dawehnerManually testing:
* a content type with a numeric field and the body field.
* setup a filter for a certain numeric value, worked.
* setup a filter for non-empty body field, worked.
* display body field worked.
So i commited it.
PS: I added fieldapi as component
TODO: create follow ups
Comment #24
dawehner.
Comment #25
dawehner@Damz: You said something about argument and sort handlers, but i cannot find my chatlog. Can you create issues where do you think things has to be done.
Comment #26
damien tournoud commentedTwo (related) bugs:
Comment #27
karens commentedPer #16, I don't think the code is yet trying to filter out deleted values.
Also, we have lost the ability to select specific items for multiple value fields and group them together into a single item -- the kinds of things that were handled in content_handler_field_multiple in D6. Not sure of the best way to approach that one. We would need to add some options to the form and then use field_view_value() on the individual items instead of field_view_field() on the field as a whole to display the result. Plus we used to jump in during pre_render to retrieve the grouped values and combine them into a single item. I'm not sure how much of that would work in D7 and how much needs to be re-factored.
Just getting these items noted, in case anyone wants to tackle them.
Comment #28
karens commentedThe component changed :(
Comment #29
aspilicious commentedI think dereine wrote a special handler for the "list field".
Comment #30
dawehnerCan't we mark this as fixed?
Everything else can be handled in the other issues.
Comment #31
esmerel commentedMarking Fixed based on dereine's comment - If it needs to be changed back, then it can be!
Comment #32
karens commentedCan someone start new issues for the things mentioned in #16 and #27? Those are not addressed yet. I will start them if I get a chance, just trying to let people know there is more work to be done.
Comment #33
dawehner#895046: Implement views_handler_field_multiple
This issue waits/depends/conflicts on #936196: Don't use entity_load to display fields
#971326: Join fieldapi fields additional on deleted = 0
Comment #35
Remon commentedI'm not trying to be theoretical here, but doesn't
if ($field['storage']['type'] != 'field_sql_storage') continue;limit views to sql stored data?