I needed this for a site I'm building, and merlinofchaos said he might be interested in adding this, so he asked me to create an issue about it. If you rename this attachment to just "image.inc" and stick it in your panels/content_types directory, you'll be able to directly insert image nodes into panes via the panel content tab. There's a selector for the image derivative size, and a way to select if you want no caption, to use the existing image node body as a caption, or enter a custom caption. At this point, to get those working you need support in your theme (since that was the easiest way to get this working on my site). If merlin's interested in this functionality, we could come up with a better way to handle this part, perhaps via a custom theme function (instead of just using node_view()) so that by default the knobs work, but people could override in their theme if they wished.

Feedback welcome.

CommentFileSizeAuthor
#7 image-DRUPAL-5--2.panels.patch6.09 KBsun
panels-image.inc_.txt5.08 KBdww

Comments

sdboyer’s picture

Ack! Sorry I missed this! I've put it back at/near the top of my list...

merlinofchaos’s picture

Tag -- can we convince image.module to take this feature on?

dww’s picture

Project: Panels » Image
Component: Plugins - content types » image.module
Assigned: dww » Unassigned

No idea, but that's probably a better place for this. I suppose the function names might want to be changed, too. However, I'm no longer using image.module (I'm using CCK + imagefield), so I don't really have much need for this particular patch anymore. I hope someone else can carry this to completion, since it's so very close.

Cheers,
-Derek

drewish’s picture

i'm really reluctant to add features to the 5 code base that aren't added to 6 first... and since pannels 2 for d6 doesn't exist yet it's a bit of a quandry.

drewish’s picture

wait, so even if i did want to add this... what would i have to do to distribute it with the image module and have panels load it up?

sdboyer’s picture

*gets excited*

There are two ways to alert Panels to the presence of your plugin. The latter's a little more complicated, but they're complications that make for nice organization, so it's my preferred method. The difference between the two is in where you put your 'plugin declaration function' - see http://doxy.samboyer.org/panels2/panels_api_plugins_content_types.html. That'll also be a handy reference for writing the rest of the content type. And in terms of forwards-compatibility with D6, very little is likely to change (at least at first) when it comes to how plugins operate. There's a decent chance it'll Just Work.

In either case, Panels' plugin system uses a specific naming scheme when it goes hunting for plugins to process. The quick & dirtier-method for getting Panels' attention is by using functions of the form $module_name . '_' . $plugin_type, so in this case, image_panels_content_types(). OG Panels (bundled with og now) does it this way, see line 560ish.

The more structured way of going about it is to implement hook_panels_include_directory(). Annoyingly enough, for some reason the panels2 doxy docs haven't properly included the docs I've written on that hook invocation, so I can't link you straight to it, but it's all written in starting around line 1330 of includes/plugins.inc. When you invoke that hook, you define some subdirectories within your own module's directories for panels to look in for a specific type of plugin. Once you've done that, Panels will check any *.inc files you put in there for plugin data as part of its normal routine. You still have to create a plugin declaration function, but the naming schema does change slightly - it becomes $module_name . '_' . $filename . '_' $plugin_type.

In both cases, the functions have to return plugin definition arrays.

If you do end up doing this, I'd love some feedback on the documentation for these various pieces...not many folks have used it yet, and I'm sure there are many improvements that can be made. I've got thick skin, so don't hold back.

sun’s picture

Assigned: Unassigned » sun
StatusFileSize
new6.09 KB

Just a few changes and this works right out-of-the-box from Image module.

grandcat’s picture

Title: Add support to insert image nodes into panes » Add support to insert image nodes into panels

* Changed title *

drewish’s picture

okay committed this to the 5.x-2.x branch... i'm always complaining about maintainers who let the perfect become the enemy of the good (*cough* *dww* *cough* ;)) so hopefully this'll give people still on 5.x another reason to upgrade to the 5.x-2.x branch.

drewish’s picture

Status: Needs review » Fixed
dww’s picture

*cough* ;) Thanks for committing. Sadly, I'll be out of town until Sept 1, so getting your other patch in will have to wait a few more weeks until then. After that, it's *VERY* high on the list, I promise... Sorry I'm so terrible.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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