I have several fields in my panel node content type, it would be great if I could use those fields when I add a 'new custom content'. I've been working a little with the custom.inc file and I already added the form including all fields associated for the panel node, but this is not working yet since the values are not saved and rendered properly.

I was wondering if anyone wants to help me out with this, since I think this functionality will be the *ultimate* functionality for Panels and Drupal... being able to add a file, an image, a link, or anything in any region inside a panel gives the user a huge amount of flexibility.

I'm attaching what I've done so far, mostly taken from the comment_cck module.

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Well, this code has a lot of problems.

1) use of arg() is discouraged.
2) CTools doesn't know anything about CCK, so really shouldn't hardcode any assumptions about it.

It does seem like there might be room to create a new content type, but I don't really see how I could put this or even a derivative of it actually in the 'custom' content type itself. At best, there might be a content type that takes a node context that lets you create sort of on the fly templates (possibly using the keyword replacement stuff) but as this is, I see it being a bit of a dead end.

lelizondo’s picture

Yeah, I'm having a lot of issues saving and rendering the field's data, probably the best way to go here (at least that's what I'm doing now) is creating several new plugins with 'common usage fields'. For example, I now have a plugin to add a new 'link' the same way you could do it with the cck link module, I'm just using the FAPI and it's easier that having a more general solution using the panel node CCK fields

I'm also trying to have an 'upload' field but I'm having some issues with this. An advice on this would be appreciated.

lelizondo’s picture

Title: Add CCK Fields to 'new custom content' in Panel Node » Mimic CCK Fields to add files, images, links and text into panes
Component: Miscellaneous » Plugins system
Assigned: Unassigned » lelizondo
FileSize
18.92 KB

Since implementing the CCK fields would be harder, I decided to just mimic some of the most popular fields.

I've just implemented 4 new plugins, file, image, link, and textfield. With this plugins panels becomes (I think) an extremely flexible module since a user can now create files, images, links and text into panes. I'll probably should implement an embedded video plugin later.

I don't think this should be part of CTools, and that's why I will create a new module (ctoolscustomplugins), but if I'm wrong, and you think that the best way to go is to create a patch for ctools, just tell me and I'll do it.

There's a couple of things I have to fix before I release the module:

1. Custom icons for each plugin
2. Validators for the file plugin (This is a security risk I'm aware of, please don't implement on any production site).

If you have any comments or recommendations I'm welcome to hear opinions. I'm attaching a zip since the module has a lot of files.

Note: The image plugin is dependent of Imagecache.

lelizondo’s picture

Project: Chaos Tool Suite (ctools) » Chaos tool custom plugins for Panels
Version: 6.x-1.x-dev » 6.x-1.0-alpha1
Component: Plugins system » Code
Status: Active » Fixed

I will mark this as fixed and move it to it's new home.

lelizondo’s picture

Status: Fixed » Closed (fixed)