We need to determine the ultimate skin include file format.
See #897822: [META ISSUE] Stop storing skins in .info files; implement skins as PHP instead for some previous discussion on the topic.
Find attached a proposed file format. We're probably going to need to refine and adjust it.
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | styles.inc_.txt | 11.78 KB | moonray |
| #28 | styles.skinr_.inc_.txt | 10.93 KB | jacine |
| #26 | styles.skinr_.inc_.txt | 10.91 KB | jacine |
| #19 | styles.skinr_.inc_.txt | 12.46 KB | jacine |
| provided_skin.inc_.txt | 1.87 KB | moonray |
Comments
Comment #1
moonray commentedSome things that come to mind; some haven't been implemented yet:
1) Naming convention. The hook part of the function names should be built as follows: for
hook_skinr_skins()[theme name or module name]_[skin or plugin name which is also the filename]_skinr_skins().2) Screenshots. Do we allow screenshots at the include file level (in
hook_skinr_info()or in this exampleskinr_provided_skin_skinr_info()or for each skin individually (inhook_skinr_skins()or in this exampleskinr_provided_skin_skinr_skins())?3) Skinr API version. Do we need to specify which version of the Skinr API this include will work with?
Please add on any other things that have been missed so far.
Comment #2
jacineOk, the following is a result of lots of discussion between @moonray and I about how the skins and groups need to be structured. There is documentation for each hook, and all the properties of each in the comments.
I added the full version of the plugin below (which is a working example) to GitHub. In addition to what's noted in the @todo's, I'll be creating more skins to test with, which implement more advanced functionality. These will all be added to the GitHub repository linked above, when finished:
Below are the contents of
styles.skinr.inc(from the GitHub repo) for reviews:Comment #3
jacineFYI, just updated the codeblock above to tweak the docs and fix some errors. I'll probably continue tweaking the docs as we work on this, and I'll try to keep comment #2 updated, but the updates will go to GitHub first: http://github.com/jacine/skins
Comment #4
sunFor example, this array needs to be processed recursively:
The keys starting with a hash sign belong to the respective element in question. Any other keys (not starting with a #-sign) do not belong to the element; i.e., they are sub-elements of the element.
Comment #5
jacineThanks @sun!
Although I don't understand the "recursive" stuff, this is what I thought needed to happen. I'll update it. :)
I'm also curious about using #attached for the CSS and JS files. From my understanding this is not limited to forms, and I would like to prevent using custom properties wherever possible and be as consistent as possible with the way core does things like this. The documentation is not fully updated yet, and I'm not sure how this would work or if it's the right thing to do here though. Can you comment on that?
Comment #6
jacineOk, I've updated this to remove the hashes from non-elements. The only one I am unsure about is #options. It's not the standard option used by FAPI, it's a custom version where we use label and class. I left the # off for now.
http://github.com/jacine/skins/blob/master/styles/styles.skinr.inc :)
Comment #7
jacine[also] edited by sun
Goal
Comment #8
sun#attached is a different beast, which we should certainly analyze in detail:
Pro
Contra
--
Overall issues I see with the proposed syntax/structure:
With #915936: Make it easier to define checkboxes/radios with customized sub-elements in place, we could attempt to move the #skins (or similar) property to the individual #options, but that's not yet possible.
Comment #9
sunComment #10
jacineI was hoping to avoid this because it's tedious to enter, but I can live with it if it needs to happen.
There needs to be an administrative title and description of a plugin. The title and description we display to and end-user is most always not the same as the title and description administrators need to see. Not having the ability to do this would be like not being able to have a description for a module name on the module listing page. I can't think of any other way to accomplish this, and I'm sure there is a better way, but it's definitely not duplication, and it is necessary at plugin-level. It is awkward at group level, I will admit that, but I don't know how to fix this. I want this information in hook_skinr_info(). I'd also like to enable/disable at plugin level, and then configure at skin level, but was told it wouldn't work there.
The only issue I have with this and the above examples is that it makes it harder for themers to grok and be able to pick up. I don't like that it's completely abstracted and I would prefer not dealing with forms at all if this is the problem, and creating our own element.
Comment #11
sunSummary of the IM discussion yesterday:
--
New proposal:
Note: Using a different array definition syntax this time to see whether it helps to understand the overall nested array structure. Keys and locations are the same as in #9, just written out differently.
This structure allows us to simply
unset($skins[$name]['form']);in all skin definitions prior to caching them.I'd suggest to discuss and agree on this detail first. Afterwards, let's discuss hook_info() properties, especially #attached.
Comment #12
Jeff Burnz commentedAt the risk of asking a silly question where would we define "features" as in block, panels pane, node etc. This is looking good.
Comment #13
sunSo Jacine just tells me that the separation into 'form' is too complex, and I think she's right.
Thus, new proposal:
Thus, when collecting skin information for processing (only), then we'd invoke hook_info(), and unset() 'type', 'title', and also every 'title' in each variant.
Comment #14
moonray commentedI took the example and expanded on it. I'm not sure if any of the added properties require hashes or not.
Things still in need of discussion:
#attached(We might not want to use #attached since these stylesheets and scripts aren't meant to be attached to the form element, but to a page where the skin has been applied to an element on the page.)hook_skinr_groups_info(), shouldn't the skins hook be distinguished ashook_skinr_skinss_info()? Can we drop the _info part (as proposed in the original version of the plugin) or will that make it un-drupally?Comment #15
nomonstersinme commented1 - how about #include or #files instead of #attach?
I'm confused by this, does it mean that if I were making a theme I would have to use $skins['font_other']['status'] and list my theme name with the status number? or could i use $skins['font_other']['default_status'] ?
Comment #16
sunTBH, I was similarly confused, and those 'default_status' and 'status'-per-theme properties make little sense to me. Would you ever want to have any skin *automatically* appear enabled on your site, just because it exists?
The situation and answer to that question is different when we're talking about exporting skin configurations into code - but that's an entirely different story and doesn't have anything in common with registering and describing skins (the task at hand).
One further property that has been added is 'source' -- all of what is visible in there does not have to be specified manually, since skins will be tied to a module or theme anyway now.
On the remaining, 'group' is cool and a no-brainer, and/but we likely want to rename 'features' into 'hooks' (or 'theme hooks').
Comment #17
nomonstersinme commentedWell this is not to have the skin actually applied to anything, its just making it available in the UI, so that it can be selected. Personally, I think ALL skins should be available by default, people are not gonna realize they have to enable them and I can see issues flooding in about it.. but thats just my opinion.
Anyway some clarification on the difference between 'default_status' and 'status' would be awesome cause i'm still a bit confused. :)
Comment #18
moonray commentedGroups example:
'admin title' and 'admin description' are needed for the admin-facing UI where the admin can enable or disabled skins in the UI (so the end-user doesn't see them in the UI)
Comment #19
jacineUpdates
Here are some updates based on conversations earlier today:
hook_skinr_api()will be used to define API information. This already exists and looks like this:admin_title,admin_descriptionandscreenshotsettings have been removed for groups. These are purely Admin UI related, and there not an "essential" skin creation syntax issue. If there is a problem, we'll deal with it separately.hook_skinr_skins()has been changed tohook_skinr_skins_info().hook_skinr_groups()has been changed tohook_skinr_groups_info().featureshas been changed totheme hooks.Suggestions have been made to name settings keys in a way that clearly separates what is a form property vs. a skinr property. After some discussion and realizing that it doesn't matter what we name these, I am opting for the simple version that will be easy for skin creators to grok. The readability of processing code should have no bearing over this because the nature of these properties. We need to keep this simple.
attachedis now being used for stylesheets and script additions. The actual functionality still needs to be discussed, but this format is a Drupal 7 standard that will be used elsewhere, so we should use it for consistency.I've removed the
labelfor the "variant/option" titles. These are titles at the end of the day, and they do not always end up aslabel's, so we should just standardize.Summary
The example has been updated on Github: github.com/jacine/skins
hook_skinr_skins_info()
hook_skinr_groups_info()
An example of how this translates to a skin, with a lot more docs is also attached. Please review.
Comment #20
moonray commentedEDIT: We need a way to pass back the plugin name without the addition of the module. If there's a better way, I'm all for it.
Comment #21
sunskinr_styles_skinr_api()was meant to be final. It should behook_skinr_api()only. The compatible API version is unique for all Skinr-related code of a certain module/theme, so I do not see a need for adding a separate 'styles' key. Initially, this hook will merely return the compatible API version. Only in a later step, we will probably also return a path to an include directory, in which skins are defined in atomic include files. Therefore:hook_skinr_skin_info()andhook_skinr_group_info()should both be singular; i.e., "skin" instead of "skins". That is, because although the hook technically allows to register more than one skin, the fundamental "thing" that is being registered is a "skin", not a "skins". (And FWIW, I originally hoped that we could get away with justhook_skinr_info()for the primary skin info hook... however, if you think thathook_skinr_skin_info()is better, that's ok, too.)Code-wise, we will have to make sure that whenever we are dealing with a skin info definition, the variable is named
$skin_infoaccordingly. Whenever the code deals with a stored skin, the variable will be$skin.Likewise, function names should follow accordingly:
Comment #22
moonray commentedp.s.
I was thinking that the work Jacine is doing with her example skin might be used as a base for #926740: Include a skinr_example.module with the Skinr module that includes an example skin. All it would need in addition is a wrapper module that probably just has the hook_skinr_api() in it.
Comment #23
sunAdditionally, I think that most of the current "handler" functionality in the /modules directory is moot for D7. I'd recommend to leave out the
'path'key for hook_skinr_api() for now. FWIW, we're leaving the entire "one skin in an atomic include file" feature to a separate issue anyway right now. And before approaching that issue, we will have to tackle that module handler functionality first. Depending on the results, we may need separate 'skin path' and 'handler path' properties, or not. As of now, I bet we will be fine with a single 'path' property.hook_skinr_skin_info()should actually behook_skinr_ui_skin_info(), because it is the Skinr UI module that requires the registered skin information to collect available skins and configure them -- the Skinr API module has nothing to do with that. The Skinr API module merely stores and loads skin entities in order to apply them at run-time.Thus, the differentiation is in "available skin [information]" and "actual skin". The actual skin is the entity of the Skinr module. Available skins are just information.
Comment #24
moonray commentedComment #25
jacineOk, sounds good. I'll update it.
Amen! This makes me very happy.
It's discouraged to do regularly. What it's good for is setting an extreme high or low weight as Bala mentioned. I'm all for the TableDrag implementation, but unless that is going to happen as part of this process, I don't want to see it removed.
And I agree with everything else, which is very exciting :)
Comment #26
jacineOk, here's the final for reference. Marking this fixed so we can move on :)
Comment #27
moonray commentedNot all classes in the example are being set using arrays.
Comment #28
jacineFixed.
Comment #29
jacineComment #30
moonray commentedThe include uses 'variants' instead of 'options'. Otherwise it's looking good (and tested to be functional).
I've fixed the 'variants' in the attached file.
Comment #31
moonray commentedJust ran into one small issue... skinr_skinr_api() should be skinr_styles_skinr_api() if we want to be consistent.
BUT... we just had a whole discussion about dropping the plugin part. Jacine or Sun, can you chime in here and say which direction we want to go?
Comment #32
sunThese API docs should naturally go into a skinr.api.php file.
@jacine: Can you commit an empty file for that? You may use title.api.php as template: http://drupalcode.org/viewvc/drupal/contributions/sandbox/sun/baseline/
Comment #33
jacineThe hook_skinr_api() should be in the module or theme's template.php as far as I understand.
I can't fully comment on the direction because I am confused. I'd like it to remain on track as it's outlined here, but I am unclear on whether or not that's possible at this point.
@sun, there is a docs/docs.php file for that. I don't have time to work on it today, but I assume that is the file that this belongs in. When it's all done it can change to skinr.api.php.
Comment #34
coltraneIf I'm caught up and understand this discussion then I don't see why the plugin part of Skinr hook definitions are at all necessary.
For the latest format in #30 there is
HOOK_skinr_api()and thenHOOK_PLUGIN_skinr_skin_info(), but if plugins are defined for modules and themes only why is there a further key used?Comment #36
jacineFrom what I understand @moonray's issue in #31 was a false alarm and that
hook_skinr_api()is defined once by the module (in the .module file) or the theme (in the template.php) implementing skins.Other than that, all that's left here is to merge this documentation in with
docs.phpand move it toskinr.api.php, so changing the priority.Comment #37
coltraneApologies if it's been covered and is clear to everyone else, but I don't understand the 'plugin' part of the other hooks. Why is the module or theme name for HOOK_(skinr_hook) not enough? What does a variable for plugin do?
Comment #38
jacine@coltrane, it basically allows for multiple sets of skin implementations to be used in the same module or theme. For example, let's say you have a theme, and you have 2 different collections of Skins:
The "plugin" allows you do define "grids" and "styles" as separate entities. Each would likely have its own directory containing any CSS/JS files and an .inc file that contains their implementation. So... you'd have:
zen_grids_skinr_skin_info()zen_styles_skinr_skin_info()If we don't specify the "plugin" part, we don't get to do this, and you'd basically have to lump all the skins in one to be able to use them. This would make sharing and managing skins way harder.
Hopefully that makes sense. :)
Since the API docs are being added in this issue #956990: Clean up and optimize skinset handling code in skinr core, so this issue should be closed.
@coltrane Feel free to reopen, if you think it's necessary. :)
Comment #39
coltraneReopening because I think the distinction between module plugins and skins should be stronger.
For example, as part of #956994: Write load and parse code for Skinr include files in PHP format the includes file loading is handling both module plugins and skins. Two separate include files are loaded in the same way and using the same function. That was not clear to me until I spoke with Jacine. In comments, skinr.api.php, and in the code we could use different terminology to make the distinction more clear.
So, I propose that for things providing integration with Skinr to allow for module-specific Skinr functionality we continue to refer to that as a "module plugin", or "plugins".
And for skins, could we drop any mention of them as plugins and just refer to them as what they are, "skins"? This would mean that instead of
hook_plugin_skinr_skin_info()we'd haveHOOK_SKINNAME_skinr_skin_info(). Jacine, to use your examples in #38gridsandstyleswould be the name for the separate entities providing the skins.Comment #40
jacineWe originally called them "skinsets" because they are basically a set of individual "skins." That was no good, so plugins was the best we could come up with. As a themer, I feel plugins is a more accurate description (and this is how CTools does panels pane and layout plugins), but obviously that is confusing the crap out of developers, so I'm of course fine with changing it.
However, the reason we needed a different name in the first place is that each hook contains skins, so calling both the "group" and its contents "skins" is confusing from a code standpoint. Maybe this is not confusing, or less confusing? I don't know.
I'm happy with anything that allows us to move on at this point. I'm admittedly frustrated with the pace, and all the confusion surrounding this, because it is not much different than what's sitting in 6.x-2.x-dev right now. We are nowhere near having a functional 7.x release, despite spending a lot of time trying to improve the module and keep this process open. It's ultimately holding up contrib themes, preventing inclusion in books, and will begin to cause LOTS of problems for us as we drastically change things while people begin to use it with Drupal 7. We just need to iron this out ASAP so we can begin to address the gazillion other issues we need to get to.
So, the question I have is:
Is calling the referring to the hook group name and the skins themselves "skins" going to be too confusing from a code standpoint?
Comment #41
coltraneI'm now OK with "plugins" so long as the code, comments, and documentation were to make the distinction clear.
In http://drupal.org/node/956994#comment-3896396 I propose not using plugin entity grouping in the _skinr_skin_info() definitions. Instead using separate plugin files to differentiate. Of course, that method depends on the plugin.skinr.inc method being chosen. I do think HOOK_PLUGIN_skinr_skin_info() is unique and confusing would like to see it change no matter what the skin include file becomes.
Seems like skinr.api.php should be about skin plugins. Should it also provide info about the module plugin hooks like
hook_skinr_config_info()? I think so.Comment #42
jacineFYI, There's a patch for API docs that include the skin hooks already that needs review: #956990: Clean up and optimize skinset handling code in skinr core. If there's anything else missing, we should definitely include it, but it would be nice to get this committed soon so that people creating skins have a good reference.
Comment #43
jacineI think we can close this. The API docs have been committed and all discussion on this is happening in #956994: Write load and parse code for Skinr include files in PHP format.