Overriding functions
Themable functions can be overridden by copying the functions and placing them in the active theme's template.php file though the template file is optional but this is the only file you can use override the function defied through various modules.
When template.php file is present in drupal active theme folder, It become resposibility of Drupal to look into this file for extra instructions and do the needful changes
- If it does not exist, create a new file named template.php inside your theme directory (use proper PHP syntax).
- Find the function you wish to customize.
- Copy the original function and paste it into the template.php file.
- Rename the function (as discussed below).
- Make your changes to the renamed function in the template.php file and save the file.
- Clear the Theme Registry.
One biggest advantage of having template.php file is that we can have one file 'template.php' that can be used to hold multiple overrides.
Overriding functions are bit faster than templates, But again this could be hard for the designer to uderstand it, especially for the ones only familiar with XHTML.
Advantage of using this option is, we can add customization to a site without having to touch the core files.
Best Resource to understand is here About overriding themable output
Please visit related Theming Blogs
- Overriding the Default Styling
- Converting Themeable function to templates
Thanks
0 Comment(s)