Metallenguatge que genera CSS
Facilita l'escriptura de CSS
Permet variables i programació
Gema de Ruby
Framework CSS
Facilita l'escriptura de CSS
Mitjançant mixins soluciona problemes freqüents
Gema de Ruby
Informació / configuració bàsica del theme; nom_del_tema.info
Informació bàsica del theme
screenshot = screenshot.png
name = Custom theme
description = Description of the custom theme
core = 7.x
base theme = zen
Carregar fulls d'estils CSS
; Esborrar estils que no necessitem
stylesheets[all][] = system.menus.css
stylesheets[all][] = system.messages.css
stylesheets[all][] = system.theme.css
stylesheets[all][] = jquery.mmenu.all.css
; Afegir els nostres propis.
stylesheets[all][] = css/styles.css
stylesheets[all][] = css/mmenu/jquery.mmenu.all.css
Carregar scripts JavaScript
; Afegir JavaScript
scripts[] = js/custom_script.js
Definir regions
; Definició de regions
regions[header] = Header
regions[navigation] = Navigation bar
regions[highlighted] = Highlighted
regions[help] = Help
regions[content] = Content
regions[sidebar_first] = First sidebar
regions[sidebar_second] = Second sidebar
regions[footer] = Footer
regions[bottom] = Page bottom
Definir breakpoints
; Definició de breakpoints.
breakpoints[mobile] = (min-width: 0px) and (max-width: 22.49em)
breakpoints[mobile_large] = (min-width: 22.50em) and (max-width: 34.35em)
breakpoints[tablet_small] = (min-width: 34.36em) and (max-width: 43.125em)
breakpoints[tablet] = (min-width: 43.13em) and (max-width: 47.9em)
breakpoints[desktop] = (min-width: 48em) and (max-width: 59.9em)
breakpoints[widescreen] = (min-width: 60em)
Altres configuracions dels temes
; Altres funcionalitats
features[] = logo
features[] = name
features[] = slogan
settings[zen_breadcrumb] = no
settings[zen_breadcrumb_separator] = ' › '
settings[zen_breadcrumb_home] = 1
Es troben dins la carpeta templates del theme i poden estar ordenats en subcarpetes (pages, nodes, views, blocks, etc)
$conf['theme_debug'] = TRUE;
Exemple de codi:
<!-- THEME DEBUG -->
<!-- CALL: theme('block') -->
<!-- FILE NAME SUGGESTIONS:
* block--system--powered-by.tpl.php
* block--system.tpl.php
* block--footer.tpl.php
x block.tpl.php
-->
<!-- BEGIN OUTPUT from 'modules/block/block.tpl.php' -->
<div id="block-system-powered-by" class="block block-system">
<div class="content">
<span>Powered by <a href="https://www.drupal.org">Drupal</a></span>
</div>
</div>
<!-- END OUTPUT from 'modules/block/block.tpl.php' -->
Inclou funcions theme, preprocess i process (PHP)
Exemple de funció preprocess_page
function custom_theme_preprocess_page(&$variables, $hook) {
$variables['sample_variable'] = t('Lorem ipsum.');
}
cristina@ymbra.com | pako@ymbra.com
@chumillas | @pakmanlh