Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Overriding Theme functions, Drupal 7

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 240
    Comment on it

    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


    1. If it does not exist, create a new file named template.php inside your theme directory (use proper PHP syntax).
    2. Find the function you wish to customize.
    3. Copy the original function and paste it into the template.php file.
    4. Rename the function (as discussed below).
    5. Make your changes to the renamed function in the template.php file and save the file.
    6. 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

    1. Overriding the Default Styling
    2. Converting Themeable function to templates

    Thanks

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: