SlideShare a Scribd company logo
1 of 95
Theme API
 Rolf van de Krol
Drupal 7.2 - default install
          bartik
      views & devel
includes/theme.inc
$html = theme(
  'item_list',
  array(
    'items' => $links,
    'title' => t('My links')
  )
);
$html = theme(
  'item_list',
  array(
    'items' => $links,
    'title' => t('My links')
  )
);
$html = theme(
  'item_list',
  $links,
  t(‘My links’)
);


$html = theme(
  'item_list',
  array(
    'items' => $links,
    'title' => t('My links')
  )
);
$html = theme(
  'item_list',
  $links,
  t(‘My links’)
);


$html = theme(
  'item_list',
  array(
    'items' => $links,
    'title' => t('My links')
  )
);
‘theme’ initialization

          ‘theme registry’ loading

      finding of callable ‘theme hook’

         including of required files

  handle some ‘render array’ specific stuff

  merging the defaults into the ‘variables’

  getting information from the ‘base hook’

executing ‘preproces’ and ‘process’ functions

   handling of ‘theme hook suggestions’

executing ‘function’ or rendering ‘template’
‘theme’ initialization

          ‘theme registry’ loading

      finding of callable ‘theme hook’

         including of required files

  handle some ‘render array’ specific stuff

  merging the defaults into the ‘variables’

  getting information from the ‘base hook’

executing ‘preproces’ and ‘process’ functions

   handling of ‘theme hook suggestions’

executing ‘function’ or rendering ‘template’
theme
registry
theme
registry


           theme($hook,
              $vars)
hook_theme
hook_theme_alter



                    theme
                   registry


                              theme($hook,
                                 $vars)
'item_list' => array(
  'variables' => array(
    'items' => array(),
    'title' => NULL,
    'type' => 'ul',
    'attributes' => array(),
  ),
  'type' => 'module',
  'theme path' => 'modules/system',
  'function' => 'theme_item_list',
);
'page' => array(
  'template' => 'page',
  'path' => 'themes/bartik/templates',
  'type' => 'theme_engine',
  'theme path' => 'themes/bartik',
  'render element' => 'page',
  'preprocess functions' => array(
    'template_preprocess',
    'template_preprocess_page',
    'contextual_preprocess',
    'overlay_preprocess_page',
    'shortcut_preprocess_page',
  ),
  'process functions' => array(
    'template_process',
    'template_process_page',
    'rdf_process',
    'bartik_process_page',
  ),
);
devel module
        http://drupal.org/project/devel

http://mydrupalinstall.com/devel/theme/registry
Building registry
  hook_theme
hook_theme_alter
hook_theme
hook_theme_alter




                    Building registry
  system_theme
   node_theme
phptemplate_theme
   stark_theme
 mytheme_theme
hook_theme
hook_theme_alter




                    Building registry
  system_theme
   node_theme
phptemplate_theme
   stark_theme
 mytheme_theme
theme




                Building registry
base theme(s)


    modules
Building registry
Building registry
PHPTemplate




Building registry
PHPTemplate




                 Building registry
Inspects theme
Inspects theme




                    Building registry
Find templates
and functions
mytheme.theme




Building registry
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

 find ‘base themes’

  register CSS files

  register JS files




                                    Using registry
include template.php
initialize themes

 find ‘base themes’

  register CSS files

  register JS files




                                                   Using registry
include template.php                theme engine
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
get callable theme hook




$html = theme(
  ‘views_view’,
  array(




                                     Using registry
    ‘view’ => $this->view,
    ‘options’ => $this->options,
    ‘rows’ => $rows
  )
);
get callable theme hook




$html = theme(
  ‘views_view’,
  array(




                                     Using registry
    ‘view’ => $this->view,
    ‘options’ => $this->options,
    ‘rows’ => $rows
  )
);
get callable theme hook


$html = theme(
  array(
    ‘views_view__myviewname’,
    ‘views_view’
  ),




                                     Using registry
  array(
    ‘view’ => $this->view,
    ‘options’ => $this->options,
    ‘rows’ => $rows
  )
);
get callable theme hook


$html = theme(
  array(




                               ns
    ‘views_view__myviewname’,




                            tio
    ‘views_view’




                         es
  ),




                       gg




                                     Using registry
                    su
  array(
                ok
    ‘view’ => $this->view,
              ho
    ‘options’ => $this->options,
             e

    ‘rows’ => $rows
         em




  )
        th




);
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
include files



‘status_report’ => array(
  'render element' => 'requirements',
  'file' => 'system.admin.inc',
  'type' => 'module',




                                         Using registry
  'theme path' => 'modules/system',
  'function' => 'theme_status_report',
  'includes' => array(
    'modules/system/system.admin.inc',
  ),
),
include files



‘status_report’ => array(
  'render element' => 'requirements',
  'file' => 'system.admin.inc',
  'type' => 'module',




                                         Using registry
  'theme path' => 'modules/system',
  'function' => 'theme_status_report',
  'includes' => array(
    'modules/system/system.admin.inc',
  ),
),
include files
‘status_report’ => array(
  'render element' => 'requirements',
  'file' => 'system.admin.inc',
  'type' => 'module',
  'theme path' => 'modules/system',




                                         Building registry
  'function' => 'theme_status_report',
  'includes' => array(
    'modules/system/system.admin.inc',
  ),
),
'status_report' => array(
  'render element' => 'requirements',
  'file' => 'system.admin.inc',
),
include files
‘status_report’ => array(
  'render element' => 'requirements',
  'file' => 'system.admin.inc',
  'type' => 'module',
  'theme path' => 'modules/system',




                                         Building registry
  'function' => 'theme_status_report',
  'includes' => array(
    'modules/system/system.admin.inc',
  ),
),
'status_report' => array(
  'render element' => 'requirements',
  'file' => 'system.admin.inc',
),
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
handle render array




$elements = array(




                                     Using registry
  '#type' => 'textfield',
  '#title' => t('My title'),
);
handle render array




$elements = array(
  '#type' => 'textfield',




                                     Using registry
  '#title' => t('My title'),
);
$html = drupal_render($elements);
handle render array
$elements = array(
  '#type' => 'textfield',
  '#title' => t('My title'),
);
$html = drupal_render($elements);




                                      Using registry
<div class="form-item form-type-
textfield">
 <label>My title</label>
 <input type="text" maxlength="128"
   size="60" class="form-text" />
</div>
handle render array




                                 Using registry
hook_element_info
handle render array

hook_element_info
array(
  '#input' => TRUE,
  '#size' => 60,
  '#maxlength' => 128,
  '#autocomplete_path' => FALSE,




                                   Using registry
  '#process' => array(
    'ajax_process_form'
  ),
  '#theme' => 'textfield',
  '#theme_wrappers' => array(
    'form_element'
  ),
);
handle render array
$elements = array(
 '#type' => 'textfield',
 '#title' => 'Shizzle',
 '#input' => TRUE,
 '#size' => 60,
 '#maxlength' => 128,




                                  Using registry
 '#autocomplete_path' => FALSE,
 '#process' => array(
   'ajax_process_form',
 ),
 '#theme' => 'textfield',
 '#theme_wrappers' => array(
   'form_element',
 ),
handle render array
$elements = array(
 '#type' => 'textfield',
 '#title' => 'Shizzle',
 '#input' => TRUE,
 '#size' => 60,
 '#maxlength' => 128,




                                  Using registry
 '#autocomplete_path' => FALSE,
 '#process' => array(
   'ajax_process_form',
 ),
 '#theme' => 'textfield',
 '#theme_wrappers' => array(
   'form_element',
 ),
handle render array




                                   Building registry
'textfield' => array(
  'render element' => 'element',
),
handle render array




'textfield' => array(
  'render element' => 'element',




                                   Using registry
),
$variables = array(
  ‘element’ => $elements
);
handle render array




                                  Using registry
   The Scary Render Array
Erik Stielstra - today at 15:15
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
get defaults for variables




$html = theme(
  'item_list',
  array(




                                            Using registry
    'items' => $links,
    'title' => t('My links')
  )
);
get defaults for variables




$html = theme(
  'item_list',
  array(




                                            Using registry
    'items' => $links,
    'title' => t('My links')
  )
);
get defaults for variables

$html = theme(
  'item_list',
  array(
    'items' => $links,
    'title' => t('My links')
  )




                                           Using registry
);
'item_list' => array(
  'variables' => array(
    'items' => array(),
    'title' => NULL,
    'type' => 'ul',
    'attributes' => array()
  ),
),
get defaults for variables




array(
  'items' => $links,




                                            Using registry
  'title' => t('My links'),
  'type' => 'ul',
  'attributes' => array()
)
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
execute preprocess and process functions


$variables




                                                Using registry
                              preprocess


                                 process
execute preprocess and process functions
array(
  'template' => 'page',
  'path' => 'themes/bartik/templates',
  'type' => 'theme_engine',
  'theme path' => 'themes/bartik',
  'render element' => 'page',
  'preprocess functions' => array(
    'template_preprocess',




                                                 Using registry
    'template_preprocess_page',
    'contextual_preprocess',
    'overlay_preprocess_page',
    'shortcut_preprocess_page',
  ),
  'process functions' => array(
    'template_process',
    'template_process_page',
    'rdf_process',
    'bartik_process_page',
  ),
)
execute preprocess and process functions
array(
  'template' => 'page',
  'path' => 'themes/bartik/templates',
  'type' => 'theme_engine',
  'theme path' => 'themes/bartik',
  'render element' => 'page',
  'preprocess functions' => array(
    'template_preprocess',




                                                 Using registry
    'template_preprocess_page',
    'contextual_preprocess',
    'overlay_preprocess_page',
    'shortcut_preprocess_page',
  ),
  'process functions' => array(
    'template_process',
    'template_process_page',
    'rdf_process',
    'bartik_process_page',
  ),
)
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
handle base hook

    handle theme hook suggestions



          views_view_field
views_view_field__archive__page__title




                                        Using registry
               node
            node__page

               region
          region__sidebar
handle base hook

handle theme hook suggestions




                                Building registry
         pattern
handle base hook

        handle theme hook suggestions




                 pattern




                                        Building registry
'node' => array(
  'render element' => 'elements',
  'template' => 'node',
),
handle base hook

        handle theme hook suggestions


                 pattern




                                        Building registry
'node' => array(
  'render element' => 'elements',
  'template' => 'node',
),


 'pattern' => 'node__'
handle base hook

        handle theme hook suggestions


                 pattern




                                        Building registry
'node' => array(
  'render element' => 'elements',
  'template' => 'node',
),


 'pattern' => 'node__'
handle base hook

        handle theme hook suggestions




                                        Building registry
'node__page' => array(
  'template' => 'node--page',
  'path' => 'path/to/mytheme',
  'render element' => 'elements'
  'base hook' => 'node',
),
handle base hook

        handle theme hook suggestions




                                        Building registry
'node__page' => array(
  'template' => 'node--page',
  'path' => 'path/to/mytheme',
  'render element' => 'elements'
  'base hook' => 'node',
),
handle base hook

        handle theme hook suggestions




theme('node__page', $elements);




                                        Using registry
theme(
  array('node__page', 'node'),
  $elements
);
handle base hook

        handle theme hook suggestions




                                        Using registry
theme('node', $elements);
handle base hook

         handle theme hook suggestions




theme('node', $elements);




                                           Using registry
template_preprocess_node

$variables['theme_hook_suggestions'][] =
 'node__' . $node->type;
$variables['theme_hook_suggestions'][] =
 'node__' . $node->nid;
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
execute function or render template file




                                          Using registry
execute function or render template file




                                          Using registry
theme_item_list($variables);
execute function or render template file

find render function

   get extension

preprocess trickery




                                             Using registry
call render function
execute function or render template file

find render function

   get extension

preprocess trickery




                                             Using registry
call render function
execute function or render template file

find render function

   get extension

preprocess trickery




                                                    Using registry
call render function        theme_render_template

        extract variables

       start output buffer

      include template file

        get and return OB
execute function or render template file




                                          Using registry
        return $output;
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
initialize themes

           get theme registry

        get callable theme hook

              include files




                                           Using registry
          handle render array

        get defaults for variables

           handle base hook

execute preprocess and process functions

    handle theme hook suggestions

 execute function or render template file
Sherlock markup & Sammy Semantic
  Andreas Sahle - today at 17.45
?

More Related Content

What's hot

MTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new APIMTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new API
Six Apart KK
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
camp_drupal_ua
 
Php tips-and-tricks4128
Php tips-and-tricks4128Php tips-and-tricks4128
Php tips-and-tricks4128
PrinceGuru MS
 

What's hot (20)

Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
How else can you write the code in PHP?
How else can you write the code in PHP?How else can you write the code in PHP?
How else can you write the code in PHP?
 
MTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new APIMTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new API
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
Your code sucks, let's fix it
Your code sucks, let's fix itYour code sucks, let's fix it
Your code sucks, let's fix it
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
 
Unit testing zend framework apps
Unit testing zend framework appsUnit testing zend framework apps
Unit testing zend framework apps
 
Drupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary EditionDrupal - dbtng 25th Anniversary Edition
Drupal - dbtng 25th Anniversary Edition
 
The Origin of Lithium
The Origin of LithiumThe Origin of Lithium
The Origin of Lithium
 
Lithium Best
Lithium Best Lithium Best
Lithium Best
 
PHP 5.3 and Lithium: the most rad php framework
PHP 5.3 and Lithium: the most rad php frameworkPHP 5.3 and Lithium: the most rad php framework
PHP 5.3 and Lithium: the most rad php framework
 
Agile database access with CakePHP 3
Agile database access with CakePHP 3Agile database access with CakePHP 3
Agile database access with CakePHP 3
 
2012 03 08_dbi
2012 03 08_dbi2012 03 08_dbi
2012 03 08_dbi
 
Lithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate FrameworksLithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate Frameworks
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
 
Advanced php testing in action
Advanced php testing in actionAdvanced php testing in action
Advanced php testing in action
 
Php tips-and-tricks4128
Php tips-and-tricks4128Php tips-and-tricks4128
Php tips-and-tricks4128
 
Fulltext search hell, como estruturar um sistema de busca desacoplado
Fulltext search hell, como estruturar um sistema de busca desacopladoFulltext search hell, como estruturar um sistema de busca desacoplado
Fulltext search hell, como estruturar um sistema de busca desacoplado
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design Patterns
 

Viewers also liked (6)

[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
 
Codeigniter : Custom Routing - Manipulate Uri
Codeigniter : Custom Routing - Manipulate UriCodeigniter : Custom Routing - Manipulate Uri
Codeigniter : Custom Routing - Manipulate Uri
 
Codeigniter : the security and the magic of hook
Codeigniter : the security and the magic of hookCodeigniter : the security and the magic of hook
Codeigniter : the security and the magic of hook
 
Introduce to Linux command line
Introduce to Linux command lineIntroduce to Linux command line
Introduce to Linux command line
 
Dynamic Linker
Dynamic LinkerDynamic Linker
Dynamic Linker
 
Rootkit 101
Rootkit 101Rootkit 101
Rootkit 101
 

Similar to Theme API

Theming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and FeelTheming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and Feel
Chris Albrecht
 
Power Theming
Power ThemingPower Theming
Power Theming
drkdn
 
Backbone.js Simple Tutorial
Backbone.js Simple TutorialBackbone.js Simple Tutorial
Backbone.js Simple Tutorial
추근 문
 

Similar to Theme API (20)

Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes
 
Theming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and FeelTheming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and Feel
 
Power Theming
Power ThemingPower Theming
Power Theming
 
Backbone.js Simple Tutorial
Backbone.js Simple TutorialBackbone.js Simple Tutorial
Backbone.js Simple Tutorial
 
Wc no
Wc noWc no
Wc no
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
Bioinformatica p6-bioperl
Bioinformatica p6-bioperlBioinformatica p6-bioperl
Bioinformatica p6-bioperl
 
How to make a WordPress theme
How to make a WordPress themeHow to make a WordPress theme
How to make a WordPress theme
 
Drupal 7 — Circle theme
Drupal 7 — Circle themeDrupal 7 — Circle theme
Drupal 7 — Circle theme
 
Bioinformatics p5-bioperlv2014
Bioinformatics p5-bioperlv2014Bioinformatics p5-bioperlv2014
Bioinformatics p5-bioperlv2014
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
 
Django Heresies
Django HeresiesDjango Heresies
Django Heresies
 
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeBioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekinge
 
Bioinformatica 10-11-2011-p6-bioperl
Bioinformatica 10-11-2011-p6-bioperlBioinformatica 10-11-2011-p6-bioperl
Bioinformatica 10-11-2011-p6-bioperl
 
Drupal theming
Drupal themingDrupal theming
Drupal theming
 
Intro To jQuery In Drupal
Intro To jQuery In DrupalIntro To jQuery In Drupal
Intro To jQuery In Drupal
 
Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919
 
Django
DjangoDjango
Django
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

Theme API

  • 1. Theme API Rolf van de Krol
  • 2.
  • 3.
  • 4.
  • 5. Drupal 7.2 - default install bartik views & devel
  • 7. $html = theme( 'item_list', array( 'items' => $links, 'title' => t('My links') ) );
  • 8. $html = theme( 'item_list', array( 'items' => $links, 'title' => t('My links') ) );
  • 9. $html = theme( 'item_list', $links, t(‘My links’) ); $html = theme( 'item_list', array( 'items' => $links, 'title' => t('My links') ) );
  • 10. $html = theme( 'item_list', $links, t(‘My links’) ); $html = theme( 'item_list', array( 'items' => $links, 'title' => t('My links') ) );
  • 11. ‘theme’ initialization ‘theme registry’ loading finding of callable ‘theme hook’ including of required files handle some ‘render array’ specific stuff merging the defaults into the ‘variables’ getting information from the ‘base hook’ executing ‘preproces’ and ‘process’ functions handling of ‘theme hook suggestions’ executing ‘function’ or rendering ‘template’
  • 12. ‘theme’ initialization ‘theme registry’ loading finding of callable ‘theme hook’ including of required files handle some ‘render array’ specific stuff merging the defaults into the ‘variables’ getting information from the ‘base hook’ executing ‘preproces’ and ‘process’ functions handling of ‘theme hook suggestions’ executing ‘function’ or rendering ‘template’
  • 14. theme registry theme($hook, $vars)
  • 15. hook_theme hook_theme_alter theme registry theme($hook, $vars)
  • 16.
  • 17. 'item_list' => array( 'variables' => array( 'items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => array(), ), 'type' => 'module', 'theme path' => 'modules/system', 'function' => 'theme_item_list', );
  • 18. 'page' => array( 'template' => 'page', 'path' => 'themes/bartik/templates', 'type' => 'theme_engine', 'theme path' => 'themes/bartik', 'render element' => 'page', 'preprocess functions' => array( 'template_preprocess', 'template_preprocess_page', 'contextual_preprocess', 'overlay_preprocess_page', 'shortcut_preprocess_page', ), 'process functions' => array( 'template_process', 'template_process_page', 'rdf_process', 'bartik_process_page', ), );
  • 19. devel module http://drupal.org/project/devel http://mydrupalinstall.com/devel/theme/registry
  • 20. Building registry hook_theme hook_theme_alter
  • 21. hook_theme hook_theme_alter Building registry system_theme node_theme phptemplate_theme stark_theme mytheme_theme
  • 22. hook_theme hook_theme_alter Building registry system_theme node_theme phptemplate_theme stark_theme mytheme_theme
  • 23. theme Building registry base theme(s) modules
  • 27. PHPTemplate Building registry Inspects theme
  • 28. Inspects theme Building registry Find templates and functions
  • 30. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 31. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 32. initialize themes find ‘base themes’ register CSS files register JS files Using registry include template.php
  • 33. initialize themes find ‘base themes’ register CSS files register JS files Using registry include template.php theme engine
  • 34. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 35. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 36. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 37. get callable theme hook $html = theme( ‘views_view’, array( Using registry ‘view’ => $this->view, ‘options’ => $this->options, ‘rows’ => $rows ) );
  • 38. get callable theme hook $html = theme( ‘views_view’, array( Using registry ‘view’ => $this->view, ‘options’ => $this->options, ‘rows’ => $rows ) );
  • 39. get callable theme hook $html = theme( array( ‘views_view__myviewname’, ‘views_view’ ), Using registry array( ‘view’ => $this->view, ‘options’ => $this->options, ‘rows’ => $rows ) );
  • 40. get callable theme hook $html = theme( array( ns ‘views_view__myviewname’, tio ‘views_view’ es ), gg Using registry su array( ok ‘view’ => $this->view, ho ‘options’ => $this->options, e ‘rows’ => $rows em ) th );
  • 41. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 42. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 43. include files ‘status_report’ => array( 'render element' => 'requirements', 'file' => 'system.admin.inc', 'type' => 'module', Using registry 'theme path' => 'modules/system', 'function' => 'theme_status_report', 'includes' => array( 'modules/system/system.admin.inc', ), ),
  • 44. include files ‘status_report’ => array( 'render element' => 'requirements', 'file' => 'system.admin.inc', 'type' => 'module', Using registry 'theme path' => 'modules/system', 'function' => 'theme_status_report', 'includes' => array( 'modules/system/system.admin.inc', ), ),
  • 45. include files ‘status_report’ => array( 'render element' => 'requirements', 'file' => 'system.admin.inc', 'type' => 'module', 'theme path' => 'modules/system', Building registry 'function' => 'theme_status_report', 'includes' => array( 'modules/system/system.admin.inc', ), ), 'status_report' => array( 'render element' => 'requirements', 'file' => 'system.admin.inc', ),
  • 46. include files ‘status_report’ => array( 'render element' => 'requirements', 'file' => 'system.admin.inc', 'type' => 'module', 'theme path' => 'modules/system', Building registry 'function' => 'theme_status_report', 'includes' => array( 'modules/system/system.admin.inc', ), ), 'status_report' => array( 'render element' => 'requirements', 'file' => 'system.admin.inc', ),
  • 47. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 48. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 49. handle render array $elements = array( Using registry '#type' => 'textfield', '#title' => t('My title'), );
  • 50. handle render array $elements = array( '#type' => 'textfield', Using registry '#title' => t('My title'), ); $html = drupal_render($elements);
  • 51. handle render array $elements = array( '#type' => 'textfield', '#title' => t('My title'), ); $html = drupal_render($elements); Using registry <div class="form-item form-type- textfield"> <label>My title</label> <input type="text" maxlength="128" size="60" class="form-text" /> </div>
  • 52. handle render array Using registry hook_element_info
  • 53. handle render array hook_element_info array( '#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#autocomplete_path' => FALSE, Using registry '#process' => array( 'ajax_process_form' ), '#theme' => 'textfield', '#theme_wrappers' => array( 'form_element' ), );
  • 54. handle render array $elements = array( '#type' => 'textfield', '#title' => 'Shizzle', '#input' => TRUE, '#size' => 60, '#maxlength' => 128, Using registry '#autocomplete_path' => FALSE, '#process' => array( 'ajax_process_form', ), '#theme' => 'textfield', '#theme_wrappers' => array( 'form_element', ),
  • 55. handle render array $elements = array( '#type' => 'textfield', '#title' => 'Shizzle', '#input' => TRUE, '#size' => 60, '#maxlength' => 128, Using registry '#autocomplete_path' => FALSE, '#process' => array( 'ajax_process_form', ), '#theme' => 'textfield', '#theme_wrappers' => array( 'form_element', ),
  • 56. handle render array Building registry 'textfield' => array( 'render element' => 'element', ),
  • 57. handle render array 'textfield' => array( 'render element' => 'element', Using registry ), $variables = array( ‘element’ => $elements );
  • 58. handle render array Using registry The Scary Render Array Erik Stielstra - today at 15:15
  • 59. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 60. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 61. get defaults for variables $html = theme( 'item_list', array( Using registry 'items' => $links, 'title' => t('My links') ) );
  • 62. get defaults for variables $html = theme( 'item_list', array( Using registry 'items' => $links, 'title' => t('My links') ) );
  • 63. get defaults for variables $html = theme( 'item_list', array( 'items' => $links, 'title' => t('My links') ) Using registry ); 'item_list' => array( 'variables' => array( 'items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => array() ), ),
  • 64. get defaults for variables array( 'items' => $links, Using registry 'title' => t('My links'), 'type' => 'ul', 'attributes' => array() )
  • 65. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 66. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 67. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 68. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 69. execute preprocess and process functions $variables Using registry preprocess process
  • 70. execute preprocess and process functions array( 'template' => 'page', 'path' => 'themes/bartik/templates', 'type' => 'theme_engine', 'theme path' => 'themes/bartik', 'render element' => 'page', 'preprocess functions' => array( 'template_preprocess', Using registry 'template_preprocess_page', 'contextual_preprocess', 'overlay_preprocess_page', 'shortcut_preprocess_page', ), 'process functions' => array( 'template_process', 'template_process_page', 'rdf_process', 'bartik_process_page', ), )
  • 71. execute preprocess and process functions array( 'template' => 'page', 'path' => 'themes/bartik/templates', 'type' => 'theme_engine', 'theme path' => 'themes/bartik', 'render element' => 'page', 'preprocess functions' => array( 'template_preprocess', Using registry 'template_preprocess_page', 'contextual_preprocess', 'overlay_preprocess_page', 'shortcut_preprocess_page', ), 'process functions' => array( 'template_process', 'template_process_page', 'rdf_process', 'bartik_process_page', ), )
  • 72. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 73. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 74. handle base hook handle theme hook suggestions views_view_field views_view_field__archive__page__title Using registry node node__page region region__sidebar
  • 75. handle base hook handle theme hook suggestions Building registry pattern
  • 76. handle base hook handle theme hook suggestions pattern Building registry 'node' => array( 'render element' => 'elements', 'template' => 'node', ),
  • 77. handle base hook handle theme hook suggestions pattern Building registry 'node' => array( 'render element' => 'elements', 'template' => 'node', ), 'pattern' => 'node__'
  • 78. handle base hook handle theme hook suggestions pattern Building registry 'node' => array( 'render element' => 'elements', 'template' => 'node', ), 'pattern' => 'node__'
  • 79. handle base hook handle theme hook suggestions Building registry 'node__page' => array( 'template' => 'node--page', 'path' => 'path/to/mytheme', 'render element' => 'elements' 'base hook' => 'node', ),
  • 80. handle base hook handle theme hook suggestions Building registry 'node__page' => array( 'template' => 'node--page', 'path' => 'path/to/mytheme', 'render element' => 'elements' 'base hook' => 'node', ),
  • 81. handle base hook handle theme hook suggestions theme('node__page', $elements); Using registry theme( array('node__page', 'node'), $elements );
  • 82. handle base hook handle theme hook suggestions Using registry theme('node', $elements);
  • 83. handle base hook handle theme hook suggestions theme('node', $elements); Using registry template_preprocess_node $variables['theme_hook_suggestions'][] = 'node__' . $node->type; $variables['theme_hook_suggestions'][] = 'node__' . $node->nid;
  • 84. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 85. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 86. execute function or render template file Using registry
  • 87. execute function or render template file Using registry theme_item_list($variables);
  • 88. execute function or render template file find render function get extension preprocess trickery Using registry call render function
  • 89. execute function or render template file find render function get extension preprocess trickery Using registry call render function
  • 90. execute function or render template file find render function get extension preprocess trickery Using registry call render function theme_render_template extract variables start output buffer include template file get and return OB
  • 91. execute function or render template file Using registry return $output;
  • 92. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 93. initialize themes get theme registry get callable theme hook include files Using registry handle render array get defaults for variables handle base hook execute preprocess and process functions handle theme hook suggestions execute function or render template file
  • 94. Sherlock markup & Sammy Semantic Andreas Sahle - today at 17.45
  • 95. ?

Editor's Notes

  1. Introduction of me. Mention Hoppinger.\nUsing a monospace font sets the tone. Lots of code.\n\n
  2. Images\nAllegory &amp;#x2018;under the hood&amp;#x2019;\n
  3. Images\nAllegory &amp;#x2018;under the hood&amp;#x2019;\n
  4. Images\nAllegory &amp;#x2018;under the hood&amp;#x2019;\n
  5. Images\nAllegory &amp;#x2018;under the hood&amp;#x2019;\n
  6. \n
  7. \n
  8. Usual call to the menu system\n
  9. The part we will be talking is mainly the theme function. What does it do? And how?\n
  10. Difference between 6 and 7\n
  11. The difference in the call lays in the passing of variables.\n
  12. What the theme function does. Concepts are highlighted using quotation marks\n
  13. The first two items are really to get the theme system running. These are executed only once. \nThe really interesting part is what is done after the theme registry is loaded. This part intensively uses the registry. It actually merely executes what is programmed in the registry.\n
  14. Let&amp;#x2019;s first take a look at the theme registry. It is used by the theme function and constructed using hook_theme and hook_theme_alter.\n
  15. Let&amp;#x2019;s first take a look at the theme registry. It is used by the theme function and constructed using hook_theme and hook_theme_alter.\n
  16. The theme registry is a very big array. You can view it as a big filing cabinet, containing a drawer for every theme hook. \nTake a look at the data for item_list and page. These data are for a basic Drupal 7 install using the normal installation and the devel module enabled. \nFor the item_list variant are a few things worth noting: the system module registers the core theme hooks using it&amp;#x2019;s implementation of hook_theme. And as you can see the function theme_item_list will be called.\nFor the page variant a few other things are interesting. First, a template will be rendered, instead of a function call. Second is that the implementation of this hook came from the bartik theme (see path and theme_path). The type however is theme_engine. The meaning of the &amp;#x2018;render element&amp;#x2019; item will be covered when talking about the render array. process and preprocess functions are available. There is no real difference between process and preprocess functions, but preprocess is executed before process.\n
  17. The theme registry is a very big array. You can view it as a big filing cabinet, containing a drawer for every theme hook. \nTake a look at the data for item_list and page. These data are for a basic Drupal 7 install using the normal installation and the devel module enabled. \nFor the item_list variant are a few things worth noting: the system module registers the core theme hooks using it&amp;#x2019;s implementation of hook_theme. And as you can see the function theme_item_list will be called.\nFor the page variant a few other things are interesting. First, a template will be rendered, instead of a function call. Second is that the implementation of this hook came from the bartik theme (see path and theme_path). The type however is theme_engine. The meaning of the &amp;#x2018;render element&amp;#x2019; item will be covered when talking about the render array. process and preprocess functions are available. There is no real difference between process and preprocess functions, but preprocess is executed before process.\n
  18. The theme registry is a very big array. You can view it as a big filing cabinet, containing a drawer for every theme hook. \nTake a look at the data for item_list and page. These data are for a basic Drupal 7 install using the normal installation and the devel module enabled. \nFor the item_list variant are a few things worth noting: the system module registers the core theme hooks using it&amp;#x2019;s implementation of hook_theme. And as you can see the function theme_item_list will be called.\nFor the page variant a few other things are interesting. First, a template will be rendered, instead of a function call. Second is that the implementation of this hook came from the bartik theme (see path and theme_path). The type however is theme_engine. The meaning of the &amp;#x2018;render element&amp;#x2019; item will be covered when talking about the render array. process and preprocess functions are available. There is no real difference between process and preprocess functions, but preprocess is executed before process.\n
  19. The theme registry is a very big array. You can view it as a big filing cabinet, containing a drawer for every theme hook. \nTake a look at the data for item_list and page. These data are for a basic Drupal 7 install using the normal installation and the devel module enabled. \nFor the item_list variant are a few things worth noting: the system module registers the core theme hooks using it&amp;#x2019;s implementation of hook_theme. And as you can see the function theme_item_list will be called.\nFor the page variant a few other things are interesting. First, a template will be rendered, instead of a function call. Second is that the implementation of this hook came from the bartik theme (see path and theme_path). The type however is theme_engine. The meaning of the &amp;#x2018;render element&amp;#x2019; item will be covered when talking about the render array. process and preprocess functions are available. There is no real difference between process and preprocess functions, but preprocess is executed before process.\n
  20. If you want to take a look at the registry itself, which can be very helpful when debugging stuff, you can take a look at the devel module.\n
  21. The hooks that build the registry\n
  22. Theme alter is rarely used, at least in themes. Modules sometimes use it. They usually put a layer between the original function and and theme() to change some variables, before it enters the normal rendering. This is however in Drupal 7 possible using preprocess function and process functions (will be covered later) because these functions also are available for theme functions.\n
  23. Most of the time, themes do not have an implementation of hook_theme. \nThat is the job of the theme engine\n
  24. Modules form the base, and themes are supposed to override that. Theme overriding is supported by the theme engine.\n
  25. Modules form the base, and themes are supposed to override that. Theme overriding is supported by the theme engine.\n
  26. Modules form the base, and themes are supposed to override that. Theme overriding is supported by the theme engine.\n
  27. Modules form the base, and themes are supposed to override that. Theme overriding is supported by the theme engine.\n
  28. Modules form the base, and themes are supposed to override that. Theme overriding is supported by the theme engine.\n
  29. The default engine is PHPTemplate. Most engines (also PHPTemplate) inspect the theme and search for theme functions and templates.\n
  30. The default engine is PHPTemplate. Most engines (also PHPTemplate) inspect the theme and search for theme functions and templates.\n
  31. The default engine is PHPTemplate. Most engines (also PHPTemplate) inspect the theme and search for theme functions and templates.\n
  32. The default engine is PHPTemplate. Most engines (also PHPTemplate) inspect the theme and search for theme functions and templates.\n
  33. The default engine is PHPTemplate. Most engines (also PHPTemplate) inspect the theme and search for theme functions and templates.\n
  34. The default engine is PHPTemplate. Most engines (also PHPTemplate) inspect the theme and search for theme functions and templates.\n
  35. The default engine is PHPTemplate. Most engines (also PHPTemplate) inspect the theme and search for theme functions and templates.\n
  36. The default engine is PHPTemplate. Most engines (also PHPTemplate) inspect the theme and search for theme functions and templates.\n
  37. The default engine is PHPTemplate. Most engines (also PHPTemplate) inspect the theme and search for theme functions and templates.\nIt is however possible to create a theme without a theme engine. A theme without an engine must have a mytheme.theme. BUT, then the theme has to implement hook_theme itself!\n
  38. Back to what the theme function does. We will look at the building of the registry during the discussion how it is used.\n
  39. First it initializes the themes.\n
  40. It determines what the current theme is and finds the base theme or base themes. Then it adds the defined css files and js files. (.info).\nAt last it runs the the initialization of the theme. \n
  41. \n
  42. Get the registry from the cache, or build it.\n
  43. To find the callable theme hook, it tries to match the contents of the $hook parameter with the theme registry.\n
  44. The hook can be an array, but that is, if you ask me, just a relic from Drupal 6. It is not even used in core. Views still uses it. In Drupal 7 we have theme hook suggestions, which will be covered later.\n
  45. The hook can be an array, but that is, if you ask me, just a relic from Drupal 6. It is not even used in core. Views still uses it. In Drupal 7 we have theme hook suggestions, which will be covered later.\n
  46. The hook can be an array, but that is, if you ask me, just a relic from Drupal 6. It is not even used in core. Views still uses it. In Drupal 7 we have theme hook suggestions, which will be covered later.\n
  47. When the callable theme hook is found, it is going to execute exactly what is setup in that hook.\n
  48. The first step is to include the files listed in include files. This is allows preprocess and process functions to be available and allows theme functions to be available.\n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n