Drupal 7 Theming Cookbook содержит множество решений, которые позволяют дизайнерам в полной мере использовать все возможности создания темы стиля своих сайтов. Книга охватывает многие аспекты от использования стандартной темы, до создания богатого дизайна и макетов, которые легки в управлении и обслуживании. Themes are among the most powerful and flexible features available when it comes to the presentation of a website. The greatest strength of Drupal lies in its design, which, when done correctly, allows developers and designers to customize and micromanage each and every aspect of the site. Furthermore, the Drupal theming system and its APIs allow for the design of custom themes that are easy to administer and maintain. This book provides a plethora of solutions that enable Drupal theme designers to make full use of all its features and its inherent extensibility to style their sites just the way they want to. It covers numerous aspects from using contributed and custom themes to leveraging the powerful Fields API introduced in Drupal 7 along with the Views and Panels modules to create rich designs and layouts that are easy to administer and maintain. |
Author(s): Karthik Kumar
Publisher: Packt Publishing
Year: 2012
Language: English
Pages: 364
Tags: Библиотека;Компьютерная литература;Системы CMS / CMF;Drupal;
Cover......Page 1
Copyright......Page 3
Credits......Page 4
About the Author......Page 5
About the Reviewers......Page 6
www.PacktPub.com......Page 7
Table of Contents......Page 8
Preface......Page 12
Introduction......Page 18
Installing and enabling a theme......Page 21
Uploading a new logo......Page 24
Uploading a new favicon......Page 26
Adding a slogan to the theme......Page 28
Displaying a different theme for administration......Page 31
Adding an existing block to the theme......Page 33
Adding a custom block to the theme......Page 35
Displaying a block only on the front page......Page 38
Controlling block visibility based on user role......Page 41
Controlling block visibility based on node type......Page 42
Introduction......Page 46
Understanding the anatomy of a theme......Page 47
Creating a subtheme based on a core theme......Page 49
Overriding base theme elements in a subtheme......Page 52
Changing the screenshot image of a theme......Page 56
Including a CSS file in a theme......Page 59
Enabling CSS optimization......Page 61
Creating the mysite module to hold our tweaks......Page 65
Adding a CSS file from a module......Page 67
Displaying a different theme for each day of the week......Page 70
Creating a fresh look using the Color module......Page 72
Introduction......Page 76
Clearing the theme registry......Page 78
Creating a theme from scratch......Page 80
Creating myzen—a Zen-based theme......Page 83
Choosing a CSS layout for myzen......Page 86
Overriding Zen template files with myzen......Page 88
Adding a custom region to myzen......Page 91
Adding a background image to the theme......Page 95
Adding a conditional stylesheet in Zen......Page 98
Modifying myzen's theme settings......Page 100
Introduction......Page 104
Changing the structure of a page using template files......Page 106
Customizing the appearance of a particular node type......Page 109
Customizing the appearance of a specific node......Page 113
Theming made easy using the Devel module......Page 117
Theme overrides using the Theme developer module......Page 119
Styling the site maintenance page......Page 122
Introduction......Page 124
Finding the right function to use to theme an object......Page 126
Analyzing variables using the Devel module......Page 129
Generating sample content using the Devel generate module......Page 131
Resetting the default theme manually......Page 133
Live preview with Web Developer......Page 135
Validating HTML and CSS using Web Developer......Page 138
Turning off JavaScript in the browser......Page 140
Disabling CSS in the browser......Page 142
Inspecting elements and debugging CSS using Firebug......Page 145
Diagnostic logging of JavaScript using Firebug......Page 148
Introduction......Page 152
Adding a variable to all node templates......Page 154
Deleting a variable from the page template......Page 157
Adding a custom theme setting......Page 160
Hiding all regions on a page......Page 162
of the submitted date......Page 166
Module-based variable manipulation......Page 169
Optimizing using hook_preprocess()......Page 171
Displaying the date field in calendar form......Page 175
Introduction......Page 178
Including JavaScript files from a theme......Page 180
Including a JavaScript file only for certain pages......Page 182
Giving the username textfield keyboard focus......Page 185
Exporting a variable from PHP to JavaScript......Page 188
Adding default text to the search textfield......Page 190
Displaying comments in compact form......Page 193
Minimizing and maximizing blocks using JavaScript......Page 196
Introduction......Page 200
Adding a menu to our theme......Page 201
Adding content pages to the menu......Page 204
Styling the Main menu......Page 206
Contextual submenus using the Menu module......Page 210
Adding a drop-down navigation menu......Page 214
Customizing breadcrumbs in Zen-based themes......Page 218
Hiding node links using CSS......Page 220
Styling all external links in a page......Page 222
Styling the Drupal pager......Page 224
Introduction......Page 230
Finding the form ID of a form......Page 231
Changing the height of a textarea......Page 234
Replacing Drupal's textareas with a WYSIWYG HTML editor......Page 237
Reorganizing fields in a form......Page 240
Replacing a standard Submit button with an image button......Page 243
Styling the comment form......Page 246
Using a fieldset to group fields......Page 251
Theming form elements from a module......Page 256
Adding class attributes to form elements......Page 259
Introduction......Page 264
Creating a new node type......Page 265
Displaying fields together using fieldgroups......Page 270
Manipulating display layouts using fieldgroups......Page 273
Theming a field using a template file......Page 276
Adding image fields using the Image module......Page 280
Using Image styles to scale and crop images on the fly......Page 283
Adding lightbox support for images......Page 286
Introduction......Page 290
Creating a simple View......Page 292
Styling a node listing using a Grid display......Page 298
Embedding a View inside a node template......Page 305
Overriding the Views table style format......Page 310
Creating a custom Views style plugin......Page 317
Introduction......Page 326
Using Panels to create a front-page layout......Page 328
Embedding content in a panel......Page 332
Styling a panel with rounded corners......Page 335
Creating custom styles with the Stylizer module......Page 338
Changing the layout of a panel......Page 342
Creating a custom panel layout......Page 345
Replacing the site contact page with a panel......Page 350
Index......Page 354