1 |
6c38d829
|
Assos Assos
|
Current state of Rubik for Drupal 7
|
2 |
|
|
-----------------------------------
|
3 |
|
|
Rubik has undergone a slight visual overhaul and structural refactoring to
|
4 |
|
|
accommodate some key changes in D7. In particular:
|
5 |
|
|
|
6 |
|
|
- Page wrapper and styles have been simplified to work both in page context
|
7 |
|
|
and overlay context.
|
8 |
|
|
- New page elements like action links, removed page elements like generic
|
9 |
|
|
footer.
|
10 |
|
|
- New icons for the admin path restructuring and nicer button styles for
|
11 |
|
|
indicating actions.
|
12 |
|
|
|
13 |
|
|
Because these changes represent a departure from the previous visual look of
|
14 |
|
|
Rubik, D7 will be using the 4.x version series. There are plans to backport
|
15 |
|
|
many of these changes to D6 in a 4.x branch as well.
|
16 |
|
|
|
17 |
|
|
### @TODO
|
18 |
|
|
|
19 |
|
|
- Update RTL stylesheets, sprites
|
20 |
|
|
- Browser testing
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
Rubik
|
24 |
|
|
-----
|
25 |
|
|
Rubik is a clean admin theme designed for use with the admin module. It features
|
26 |
|
|
a set of icons for admin pages provided by Drupal core and aggressive styling to
|
27 |
|
|
reduce visual noise wherever possible.
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
Requirements
|
31 |
|
|
------------
|
32 |
|
|
You must install the [Tao][1] base theme for Rubik to operate properly.
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
Overview for subthemers
|
36 |
|
|
-----------------------
|
37 |
|
|
Rubik can be used quite successfully as a base for non-admin themes. Here are
|
38 |
|
|
some reasons you might want to use Rubik as a base theme:
|
39 |
|
|
|
40 |
|
|
- You want to inherit its styling for form and other major page elements.
|
41 |
|
|
- You want to inherit its admin-element styling, e.g. you want to use the same
|
42 |
|
|
theme for both the frontend and backend.
|
43 |
|
|
- You want to inherit form layouts and preprocess routing that Rubik provides.
|
44 |
|
|
|
45 |
|
|
Before beginning to subtheme based on Rubik, please read the README included
|
46 |
|
|
with Tao. As Rubik is a subtheme of Tao, many of the principle and ideas in Tao
|
47 |
|
|
apply to subtheming Rubik as well.
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
### Form theming
|
51 |
|
|
|
52 |
|
|
To work with form theming in Rubik (and Drupal in general) you should become
|
53 |
|
|
familiar with [`drupal_render()`][2]. Form rendering in Rubik is done in the
|
54 |
|
|
**template file**, not the preprocess, allowing any additional preprocessors to
|
55 |
|
|
alter the form in its structured state.
|
56 |
|
|
|
57 |
|
|
Rubik pushes many system forms through a series of additional preprocess
|
58 |
|
|
functions before templating.
|
59 |
|
|
|
60 |
|
|
- `rubik_preprocess_form_buttons()` detects any root level submit and button
|
61 |
|
|
type elements and groups them together under `$form['buttons']` so they can be
|
62 |
|
|
placed in a wrapping element.
|
63 |
|
|
- `rubik_preprocess_form_legacy()` handles legacy theme function-based forms
|
64 |
|
|
that use a declared theme function. It will first render the form using the
|
65 |
|
|
function specified by `#theme` and then generate a form array that can be used
|
66 |
|
|
with `drupal_render()` in templates.
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
### Icon classes
|
70 |
|
|
|
71 |
|
|
The admin icons in Rubik are displayed using a CSS sprite and corresponding CSS
|
72 |
|
|
class. The class that refers to each icon is based on a link path to the admin
|
73 |
|
|
page. For a path at `admin/settings/foo`, the classes added to the containing
|
74 |
|
|
element of `span.icon` are:
|
75 |
|
|
|
76 |
|
|
- `path-admin-settings-foo`
|
77 |
|
|
- `path-admin-settings`
|
78 |
|
|
- `path-admin`
|
79 |
|
|
|
80 |
|
|
This allows for your element to fallback to a more generic, placeholder icon if
|
81 |
|
|
the most specific class cannot be used.
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
### Object & form template layouts
|
85 |
|
|
|
86 |
|
|
Rubik groups elements in the tao object template and various forms into two
|
87 |
|
|
columns.
|
88 |
|
|
|
89 |
|
|
- For object templates (`theme('node')`, `theme('comment')`, etc.) you can
|
90 |
|
|
switch to a typical 1-column layout in you preprocess function:
|
91 |
|
|
|
92 |
|
|
$vars['layout'] = FALSE;
|
93 |
|
|
|
94 |
|
|
- For form templates, you should use `hook_theme()` to and declare the form's
|
95 |
|
|
template as `form-simple`. If a prior preprocess has moved form elements in
|
96 |
|
|
`$vars['sidebar']` for the form, you will need to move them back to the
|
97 |
|
|
`$vars['form']` element.
|
98 |
|
|
|
99 |
|
|
// Switch comment form back to simple layout.
|
100 |
|
|
function mysubtheme_theme() {
|
101 |
|
|
$items['comment_form'] = array(
|
102 |
|
|
'arguments' => array('form' => array()),
|
103 |
|
|
'path' => drupal_get_path('theme', 'rubik') .'/templates',
|
104 |
|
|
'template' => 'form-simple',
|
105 |
|
|
);
|
106 |
|
|
return $items;
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
### Stylesheets
|
111 |
|
|
|
112 |
|
|
- `core.css` provides styles for standard Drupal core markup elements, in
|
113 |
|
|
particular form elements, list items, pagers, etc. It does not style any "page
|
114 |
|
|
wrapper" or "design elements" like the site logo, navigation, etc.
|
115 |
|
|
- `icons.css` provides styles for the admin icons provided by Rubik.
|
116 |
|
|
- `style.css` provides styles for the Rubik admin theme page wrapper and other
|
117 |
|
|
aesthetic elements. This includes the site title, tabs, navigation, breadcrumb,
|
118 |
|
|
etc. **This is the file you will most likely want to override to begin your
|
119 |
|
|
subtheme.**
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
Maintainer
|
123 |
|
|
----------
|
124 |
|
|
- yhahn (Young Hahn)
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
[1]: http://drupal.org/project/tao
|
128 |
|
|
[2]: http://api.drupal.org/api/function/drupal_render/6 |