D7 Theming

From Things and Stuff Wiki
Revision as of 14:26, 28 February 2013 by Milk (talk | contribs) (→‎Modules)
Jump to navigation Jump to search


Basics

Modules

  • Code per Node makes it possible to add custom CSS and Javascript per node, per block, and per content type. The code is stored in the database, but served from the file system. It also supports syntax highlighting with CodeMirror.
  • CSS Injector allows administrators to inject CSS into the page output based on configurable rules. The CSS is added using Drupal's standard drupal_add_css() function and respects page caching, etc.
  • JS injector - drupal_add_js() function and respects page caching, etc.

Development

Backwards compatibility

Layout

Various different methods

Views
Nodequeue
Blocks
Panels
Context
Spaces

Templates

  • etc.

block

<div id="block-<?php print $block->module . '-' . $block->delta; ?>" class="<?php print $classes; ?> "<?php print $attributes; ?>>
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2><?php print $block->subject ?></h2>
  <?php endif;?>
  <?php print render($title_suffix); ?>
 
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>

Forms

For beyond basic content types field layouts;

function milk_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'contact_node_form') {
    $form['actions']['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Send'),
    );
  }
}

Responsive