Giter VIP home page Giter VIP logo

domination_tools's Introduction

A toolbox of functions to help you theme Drupal sites.

Code snippets and documentation for dominating the theme layer and creating efficient, extensible and not least submissive markup.

Injecting classes

Most of these functions are intended to inject classes for styling into your Drupal site to allow for a more object oriented approach to CSS.

Expanding template suggestions

Secondly the functions expand on Drupal core's template suggestions and give examples of how to insert custom template suggestions to streamline the number of tpl.php-files in your theme.

How to use it

  • Copy the functions you need to your template.php
  • Replace any instance of THEMENAME with the system name of the theme.
  • Replace any instance of MENU_NAME or FORMID with the system name of the menu or formID of the form.
  • Adapt, remove or combine conditions as your design dictates.
  • Remove all unneeded code.

The Render Array And You

Most of these preprocess functions work by manipulating Drupal's render arrays. A reasonable understanding of how they work are really recommended even though just pasting code would probably work 8 times out of 10.

Here is some suggested reading:

Mostly Consistent (and Harmless)

The structure of your render arrays will often vary depending on your base theme and installed modules. Themes like Omega and modules like Context change the structure of the render arrays.

Inspect render arrays

Remember you can always inspect render arrays.

The best way to do this is to install and enable Devel module (drupal.org/project/devel). This allows you to print out nicely formatted render arrays with either:

  • kpr($vars) that prints out the information when the function is run, or
  • dsm($vars) that prints out the information in the Drupal messages.

Contributors

Contributions by:

domination_tools's People

Contributors

woeldiche avatar cableman avatar

Watchers

James Cloos avatar Trevor Lazarus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.