I'd like to add a 'Add skin configuration' form which will let you edit any existing element on the site (that is implemented for Skinr).

This will help us work around most of the issues with Panels and Views without having to go all that way and do the full rules revamp (which will be pretty massive). We can reuse that code once we decide to implement the rules revamp.

Comments

moonray’s picture

Status: Active » Needs work
StatusFileSize
new10.41 KB

This patch adds a link to admin/appearance/skinr which allows you to 'Add skin configuration'.

Implemented for blocks, comments, nodes, views (panels is still too much of a mess... trying to wrap my head around that... again).

I'm not entirely happy with the language used in the interface. Also, this should include some JS like Fields UI
has to hide all the irrelevant Element options once you selected your Type.

jacine’s picture

Using contextual links would have been nicer, but unfortunately that's not possible. According to @moonray there is no context:

So we have no idea which view or panel we are trying to add a link for at that point.

Views' contextual links get attached to the page hook. That means context is all off. Luckily they add some context, which is what I can pick up. But it's not really the element you expect it on. That's what threw me off initially.

Panels... that is a completely different cup of tea. Getting to that through hook_panels_pane_content_alter().

Given that, I think this patch is ok once all of the functions are documented and the validation portion is added.

moonray’s picture

@jacine: Just to clarify... we ARE using contextual links. We're just not using the recommended hooks to add our links to them (which is what the above quote was about). The only elements we can't use contextual links on are panels' display and panels' regions.

jacine’s picture

Err, yeah. I meant hook_contextual_links_view_alter()

moonray’s picture

Status: Needs work » Needs review

Here's a functional patch. It includes some much-needed tests for our functionality plugins (including panels and views) to ensure our contextual links are properly added, and that the new hook_skinr_ui_element_options() returns the expected data.

The patch still needs integration with the panels_mini module.
Also, I got stuck writing the panels_node integration tests due to my inability to programmatically add panes to the panel node (see #1154468: Need a way to add content to panel node without using ajax). Any help there would be appreciated.

moonray’s picture

StatusFileSize
new28.75 KB

And the patch, of course...

sun’s picture

Status: Needs review » Needs work

Frankly, I'm not convinced that this patch is the right thing to do at this point in time. It adds a lot of custom and module-specific logic to Skinr -- whereas I actually hoped that our intention would be to decrease the amount of custom code.

It is definitely going to hinder progress on the further API changes that we need to do.

That's not to say this patch or idea would be entirely wrong, but for me it feels like trying to stick a piece of fancy on an ugly pig.

+++ modules/block.skinr.inc
@@ -30,30 +30,43 @@ function block_skinr_config_info() {
+    $blocks = _block_rehash($theme);

RED WARNING LIGHTS AND ALARM BELLS should trigger here.

_block_rehash() is not only not cached, but additionally, it's purpose is to rebuild and update the {block} DB table.

Powered by Dreditor.

jacine’s picture

Frankly, I'm not convinced that this patch is the right thing to do at this point in time. It adds a lot of custom and module-specific logic to Skinr -- whereas I actually hoped that our intention would be to decrease the amount of custom code.

It is definitely going to hinder progress on the further API changes that we need to do.

@sun do you see an alternative way of accomplishing it? This particular issue has been a problem for over a year, even with Drupal 6 before using contextual links. If you have any suggestions, they'd be appreciated. :)

We need this working though, so we can't wait around for perfection.

vrajak@gmail.com’s picture

Tested the patch in #6 as working with general skins and panels, but I didn't extensively tests panel usage, just creating a panel page and using a skin there. I didn't try using mini panels since you said it still needs integrating.

Trying to add a view was initially giving me a fatal error until I updated the views module, then it was fine. Is there anything else I should try and look for/test here?

BenK’s picture

Subscribing

moonray’s picture

Status: Needs work » Needs review
StatusFileSize
new28.08 KB

Rerolled and updated the patch to work with the latest version. The call to _block_rehash() has been removed; it's been replaced by a custom function that replicates a lot of its code, but excludes the block table rebuild and includes some caching.

moonray’s picture

Status: Needs review » Fixed

Committed the patch.

Status: Fixed » Closed (fixed)

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