This is a follow-up task spawned from #256471-2: Expand API-based control over pane type configuration forms. It'd be really great if when you define a new pane content type, you could control what gets rendered in the pane during panel content editing. Should be relatively trivial to add. Something like the attached back (the results of joint effort by sdboyer and myself in IRC just now).

Comments

dww’s picture

dww’s picture

StatusFileSize
new879 bytes

Whoops, syntax error in the last patch. This one is actually tested and working.

dww’s picture

Here's a trivial example of what I need this for:

/**
 * Render a story pane for editing on the content tab.
 */
function sw_panels_story_edit_render($display, $pane) {
  $block = new stdClass();
  $node = node_load($pane->configuration['nid']);
  $block->title = check_plain($node->title);
  return $block;
}

Here's a more complicated example:

/**
 * Render an image pane for editing on the content tab.
 */
function sw_panels_image_edit_render($display, $pane) {
  $block = new stdClass();
  $conf = $pane->configuration;
  $node = node_load($conf['nid']);
  $block->title = check_plain($node->title);
  $size = !empty($conf['image_size']) ? $conf['image_size'] : '242';
  $block->content = theme('imagecache', $size, $node->field_image[0]['filepath']);
  return $block;
}
dww’s picture

Status: Needs review » Needs work

Ok, I'm re-rolling this to include a patch against docs/sample_plugin_ct.inc -- stay tuned.

dww’s picture

Status: Needs work » Needs review
StatusFileSize
new3.02 KB

I'm not 100% sure I got all that doxygen stuff right, but I think this is pretty close...

sdboyer’s picture

Awesome. I'll see if any clean-up needs to be done, do it, and see that this gets committed tonight.

dww’s picture

Note: please see #270559: After editing a pane, the "portlet" collapse/expand behavior is lost which is a bug made more obvious by this new feature... Any help on how to debug/fix that would be most appreciated. ;) Thanks.

dww’s picture

StatusFileSize
new3.87 KB

New patch that re-invokes 'editor render callback' after editing a pane. This partly fixes #270559: After editing a pane, the "portlet" collapse/expand behavior is lost but not completely. I'm still investigating that one right now.

sdboyer’s picture

Wow.

So much for "committing it tonight." Really sorry about that, man.

In any case, I've tested it, and it's all good. Two thumbs up - committed. Thanks!

sdboyer’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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