Hello,

I was wondering what the best way would be to override/alter the Add content model box under the edit-panel page. Basically what I need is a way to individually theme the each 'pane' and have the ability to add a description (along with some other content). Moreover I need to have a textbox that will filter down the panes based on taxonomy. Getting that filter form to work is not a problem, what I am having difficulty with is putting it there.

I've looked through the API and documentation but didn't find any hooks or forms that I could easily alter to achieve this. I've gotten this functionality to work with the previous panels version by kinda hacking the theme registry and creating my own form, but the includes/display-edit.inc file has changed quite a bit from the last panels version. Ideally I would like a solution that would work without modifying the actual panels files and just creating another module that overrides what ever needs to be over written.

I've attached a screen shot of what I would like the Add-Content model box to look like. Thanks for any help and support on this matter! :)
JP Levac

Comments

merlinofchaos’s picture

Hm. This modal is currently not overridable at all, unfortunately. Currently this is handled by the panels_renderer_editor object and it just displays its thing. Going forward this probably is something we need to make more customizable, especially for the IPE, but it'll require a bit of a retool in how this is displayed.

populist’s picture

Title: Override 'Add content' Modal box » Theme 'Add content' Modal box
Version: 6.x-3.7 » 7.x-3.x-dev
Component: API » User interface
Category: support » feature
StatusFileSize
new132 KB

If this screen could be customized, I think that opens up a lot of really neat opportunity for the Panels admin interface to be really customized (especially with IPE) to meet certain end user use cases. Attached is a possible direction that we could go by running the HTML generation routines for the various elements on the page through some standard theme function. My thinking is that we can just abstract the HTML generation logic already in panels_renderer_editor and allow developers to theme override the display to achieve particularly custom results. We could even use different theme functions for the different render pipelines so IPE users would get a different experience than normal admin users.

yareckon’s picture

sub

merlinofchaos’s picture

Status: Active » Needs review
StatusFileSize
new8.28 KB

I started breaking it up like in the image, but I started feeling like a single template actually made more sense. If you're going to change something you're probably going to change the whole thing.

Here's a patch.

It should contain no HTML changes at all, but it does eliminate 2 methods from the renderer and replace them with a theme preprocess, process and a template.

populist’s picture

I did an initial review of the patch and it applied cleanly to my installation + didn't introduce any new complexity + allowed me to apply additional stylizing to the page. It seems like a good step forward, but it *doesn't* give control over markup generated by:

$vars['renderer']->render_add_content_link($vars['region'], $content_type);

This is the critical piece IMO for the "add content" screen since this is where you would inject additional information into the actual clickable area that adds the content. Without it, you are stuck with the basic pattern of having a small icon + title as the actual "Add" functionality.

merlinofchaos’s picture

Status: Needs review » Fixed

Ok; just calling your own thing instead of render_add_content_link probably would've worked just as well, but I went ahead and made that themable. I don't actually think it'll be easier with that themable, but we'll see. Committed and pushed.

populist’s picture

Thanks much!

Status: Fixed » Closed (fixed)

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

tim.plunkett’s picture

Status: Closed (fixed) » Needs work

When there is no category, two errors occur:

http://php.net/range takes two arguments, not just one:

http://drupalcode.org/project/panels.git/blob/refs/heads/7.x-3.x:/includ...

And $variables['columns'] is never set.

I can fix the latter, but not sure what range was supposed to be doing.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new1.06 KB

This should help.

tim.plunkett’s picture

Category: feature » bug
Issue tags: -panels, -themeing
StatusFileSize
new42.99 KB
new2.16 KB

Took a second look at this, here's a more complete fix.

  • Removed the call to range in favor of array_fill
  • Made sure that some stupid preprocess didn't set column_count below 1
  • Fixed undefined index error in template_preprocess_panels_add_content_link
  • Wrapped the panels-section-columns div in a !empty
  • Removed the stray $category link (see screenshot)
merlinofchaos’s picture

+    $columns = ($vars['column_count'] > 0) ? $vars['column_count'] : 1;
+    $vars['columns'] = array_fill(1, $columns, '');

What about using $vars['columns'] = array_fill(max(1, $vars['column_count']), $columns, '') instead?

tim.plunkett’s picture

StatusFileSize
new2.13 KB

The max part looks better, but $columns is used further down so it needs to be outside the array_fill.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed and pushed. Thanks!

Status: Fixed » Closed (fixed)

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

  • Commit 321cda0 on 7.x-3.x, 7.x-3.x-i18n, 8.x-3.x by merlinofchaos:
    Issue #933748: Make add content modal themable.