Important Drupal Theming Concepts
What we will be covering
- The fuzzy line between theming and developing
- How to override the output of virtually everything
- The best place to put your modifications
- The components of a theme
- Quick Solutions to common theming problems
How to determine which method to use when modifying output
Questions
Q: Does the modification simply change the position of an element or its look on the page ?
A: CSS whenever possible. May need to add HTML wrappers with preprocessing functions.
Q: Is this change - good for themers to have access to?
A: If yes - the change must be done in the template file or theme function - the theme layer
Q: Does the change contain any logic
A: Use preprocessing function. Very simple logic ( If a value exists, for example ) can be put in the template file or theme function.
Q: Will you want to reuse the modifications?
A: Explore module-based solutions
Q: Do you need to apply this changes as quickly as possible?
A: Use configuration, if possible. If not available, see if contributed modules can add the configuration you need.
Q: Do you need to apply this changes as quickly as possible?
A: Use configuration, if possible. If not available, see if contributed modules can add the configuration you need.
A conceptual introduction to the Features module for exporting configuration options as code
Benefits of feature module
-
Wrap configuration to code
-
Distribute configuration accross multiple projects
-
Use version control to save configuration
How to decide whether to use a module or a theme for your modifications
Depends on -
-
Who you are working with.
-
How often your piece of code needs modification
-
Does it have a layer above it for modification
How to decide when to use a theme function or template file
How the theme registry works
How to find out where any piece of output comes from
What view modes are and why you would use them
How to adjust node view modes through the user interface
What are field formatters and how to use them to modify field output
How coding standards apply to the theme layer, and how to add comments to template files
Template file coding standards and conventions
How to apply CSS coding standards
Theme troubleshooting and what to do when you don't see your theme output changes applied
How to troubleshoot CSS problems in your theme
Important Theming Concepts
By Saket Kumar
Important Theming Concepts
- 340