CCK Fields in Panels only from last Content Type

seoscout - May 30, 2009 - 08:53
Project:Panels
Version:6.x-3.x-dev
Component:Plugins - content types
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

if you define multiple similiar content types like real estate objects (house-buy, house-rent, ...) and share cck fields (like house-area), only the last defined content type will carry out the cck fields in panels (via content).

for example
- content-type {house-rent} has cckfields {house-area, house-color, house-rent-price}
- content-type {house-buy} has cckfields {house-area, house-color, house-buy-price}

now define a system-panel-page to override presentation of nodes of type {house-buy}. choose panel-content / "content" and you will see all cckfields.
but if you define a system-panel-page to override presentation of nodes of type {house-rent}, you can only see {house-rent-price} under pandel-content / "content"...

the actual cckfield-chooser in 6.2.dev does not come up with the cckfields that are "also used by other" content-types. i think this isn't the way it should be. this makes it impossible to use defined cckfields in "another content-type".

workaround 1: define all cckfields unique per content-type. not satisfying. ;-(
workaround 2: define a system-panel-page selector that selects all desired content-types. this way all cckfields show up. but of course even content-types are "similiar" there are some differences also on presentation...

i hope you understand what-i-mean and can fix this easily (and soon) ;-)

/frank

#1

yched - June 2, 2009 - 13:19
Status:needs review» active

Yes, the current code does (simplified) :

foreach (content_fields() as $field) {
  $info['title'] = t('TYPE_NAME : FIELD_NAME')
  // ...
  $types['TYPE_NAME:FIELD_NAME'] = $info;
}
return $types;

This returns each field *once*, and thus shared fields seem to appear only for the last node type they were added to.
I *think* in the end it doesn't make any difference, and you'll still get the expected result if you pick a field for a node type where it doesn't seem to exist.

Would be good to solve the UI text ($info['title']). Views integration does something like : 'FIELD_LABEL - Appears in LIST_OF_NODE_TYPES'. The list of node types where the field appears can be built with :

    foreach (content_types() as $type) {
      if (isset($type['fields'][$field['field_name']])) {
        $types[] = $type['name'];
      }
    }

What I don't know is : is it important to have the keys of the returned $types array include the TYPE_NAME ?
Michelle ? Earl ?

#2

seoscout - June 2, 2009 - 22:09

thanks for your detailed reply, yched ;-)

if your panel-page overrides for system pages does only a "restructure/reformat" of _all_ your content types, everything is ok. then someone can define an override for all desired content-types and all is fine.

but if you need or want to create different panels for different content-types that share some or many cck-fields, you are in trouble: won't work.

imagine the various real-estate-types like (house-sale, house-rent, flat-sale, flat-rent, ...) they all could have a different look if this works. and if this works, anyone can build real-estate-sites or portals with drupal only. no need for any other software like open-realty (which is fine, but limited) to integrate.

currently i am working on a real-estate-portal powered "only" by drupal and i am willing to promote this solution and drupal itself ;-)

/frank

#3

yched - June 4, 2009 - 12:13
Project:Content Construction Kit (CCK)» Panels
Version:6.x-2.x-dev» 6.x-3.x-dev
Component:Panels Integration» Plugins - content types

Technically, this belongs to the CCK queue, but I'll temporarily bump to Panels to get Michelle's attention :-)

#4

gomerpyle - June 13, 2009 - 14:25

I was just about to post on this as well, since the bug has bitten me. Now that I see that the pros have been notified, I thought I would offer up the workaround/hack that I am using. It allows you to create different panels for different content types, is simple, and shouldn't pose too many problems once this issue is solved correctly.

I am simply creating two different "Selectors" in the task handler portion of the setup. The first is Node: Type, wherein I select all of the node types available. This opens up all fields to the panel content->content section. Then I add another selector of type Node: Type but only select the type of node I actually want to override. By selecting the "All criteria must pass" checkbox I ensure that it doesn't affect the other content types.

This method makes the panel content->content section much more cluttered with fields, and I have to be quite diligent in working out which fields I have added or not added, but it works. Hopefully there will be a better solution soon.

For what it is worth, I don't think that the $types array MUST include the TYPE_NAME ?. It might be a useful indicator for some, but as I am only manipulating one content type at a time it is a non issue.

#5

gomerpyle - June 13, 2009 - 16:35

Update. Perhaps seoscout meant the last content type "alphabetically" when he wrote last content type created.
As a modification to my method above I am now doing the following:

Create bogus, never used content type called xxxx so that it is always last on the list. Populate that content type with all of the fields which are shared across content types.

When choosing your selectors, you will only need to make one rule which has both the content type you wish to alter as well as xxxx selected.

Thats all.

#6

seoscout - June 13, 2009 - 18:02

nice workaround, gomerpyle ;-)

i wish i already had more experience with drupal, but i'm just beginning. i'm looking forward to understand more of drupal and the way it works to get into the code myself.

#7

zmove - June 23, 2009 - 16:56

Hi,

I bump this issue, tested on panels 3 beta 2 and 3.x dev, and CCK 2.4 or CCK 6.x dev, the issue is still here.

Any news about it ?

#8

BenGman - August 6, 2009 - 23:10

(Subscribing)

Same issue here, have to try the bogus content type workaround.

Update: bogus content type did not work for me.

Update 2: Tried again after sometime, played around with contexts and arguments and works now, thanks!

#9

halstead - July 17, 2009 - 23:56

(Subscribing)

Still seems to be an issue with the newest version in CVS today. Thanks for the workaround.

#10

merlinofchaos - July 20, 2009 - 13:52
Status:active» postponed (maintainer needs more info)

I am completely unable to reproduce this. I created 3 types with some shared fields and some non shared fields and I tried every combination I could come up with and they all did the right hting.

#11

markus_petrux - July 21, 2009 - 09:39

CCK Fields integration in Panels was recently reviewed, and fields are now exposed using the field_name as a ctools content type key.

This allows to reuse the same CCK Field pane between panels meant to process nodes of different types. Because Fields can be shared in CCK, this pattern is also applied now when fields are exposed to Panels.

Related issue in CCK queue: #505278: Panels 3 and multiple node type fields.

#12

merlinofchaos - July 21, 2009 - 17:11
Status:postponed (maintainer needs more info)» fixed

Ok, then that probably means this issue is actually fixed.

#13

seoscout - July 23, 2009 - 21:16

well thanks to the project owners (cck & panels). i'll try it out the next night, when i have the website mainly for me ;-)

the real-estate site i was talking about is launched under http://clever-immo.de. there will be an article about drupal within next month with a big hug for drupal ;-)

great work!
/frank

#14

System Message - August 6, 2009 - 21:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.