[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/includes/ -> theme.inc (summary)

(no description)

File Size: 2044 lines (71 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 0 files

Defines 45 functions

  init_theme()
  _init_theme()
  theme_get_registry()
  _theme_set_registry()
  _theme_load_registry()
  _theme_save_registry()
  drupal_rebuild_theme_registry()
  _theme_process_registry()
  _theme_build_registry()
  list_themes()
  theme()
  drupal_discover_template()
  path_to_theme()
  drupal_find_theme_functions()
  drupal_find_theme_templates()
  theme_get_settings()
  theme_get_setting()
  theme_render_template()
  theme_placeholder()
  theme_status_messages()
  theme_links()
  theme_image()
  theme_breadcrumb()
  theme_help()
  theme_submenu()
  theme_table()
  theme_table_select_header_cell()
  theme_tablesort_indicator()
  theme_box()
  theme_mark()
  theme_item_list()
  theme_more_help_link()
  theme_xml_icon()
  theme_feed_icon()
  theme_more_link()
  theme_closure()
  theme_blocks()
  theme_username()
  theme_progress_bar()
  theme_indentation()
  _theme_table_cell()
  template_preprocess()
  template_preprocess_page()
  template_preprocess_node()
  template_preprocess_block()

Functions
Functions that are not part of a class:

init_theme()   X-Ref
Initialize the theme system by loading the theme.


_init_theme($theme, $base_theme = array()   X-Ref
Initialize the theme system given already loaded information. This
function is useful to initialize a theme when no database is present.

param: $theme
param: $base_theme
param: $registry_callback

theme_get_registry($registry = NULL)   X-Ref
Retrieve the stored theme registry. If the theme registry is already
in memory it will be returned; otherwise it will attempt to load the
registry from cache. If this fails, it will construct the registry and
cache it.


_theme_set_registry($registry)   X-Ref
Store the theme registry in memory.


_theme_load_registry($theme, $base_theme = NULL, $theme_engine = NULL)   X-Ref
Get the theme_registry cache from the database; if it doesn't exist, build
it.

param: $theme
param: $base_theme
param: theme_engine

_theme_save_registry($theme, $registry)   X-Ref
Write the theme_registry cache into the database.


drupal_rebuild_theme_registry()   X-Ref
Force the system to rebuild the theme registry; this should be called
when modules are added to the system, or when a dynamic system needs
to add more theme hooks.


_theme_process_registry(&$cache, $name, $type, $theme, $path)   X-Ref
Process a single invocation of the theme hook. $type will be one
of 'module', 'theme_engine', 'base_theme_engine', 'theme', or 'base_theme'
and it tells us some important information.

Because $cache is a reference, the cache will be continually
expanded upon; new entries will replace old entries in the
array_merge, but we are careful to ensure some data is carried
forward, such as the arguments a theme hook needs.

An override flag can be set for preprocess functions. When detected the
cached preprocessors for the hook will not be merged with the newly set.
This can be useful to themes and theme engines by giving them more control
over how and when the preprocess functions are run.

_theme_build_registry($theme, $base_theme, $theme_engine)   X-Ref
Rebuild the hook theme_registry cache.

param: $theme
param: $base_theme
param: theme_engine

list_themes($refresh = FALSE)   X-Ref
Provides a list of currently available themes.

If the database is active then it will be retrieved from the database.
Otherwise it will retrieve a new list.

param: $refresh
return:

theme()   X-Ref
Generates the themed output.

All requests for theme hooks must go through this function. It examines
the request and routes it to the appropriate theme function. The theme
registry is checked to determine which implementation to use, which may
be a function or a template.

If the implementation is a function, it is executed and its return value
passed along.

If the implementation is a template, the arguments are converted to a
$variables array. This array is then modified by the module implementing
the hook, theme engine (if applicable) and the theme. The following
functions may be used to modify the $variables array. They are processed in
this order when available:

- template_preprocess(&$variables, $hook)
This sets a default set of variables for all template implementations.

- template_preprocess_HOOK(&$variables)
This is the first preprocessor called specific to the hook; it should be
implemented by the module that registers it.

- MODULE_preprocess(&$variables, $hook)
This will be called for all templates; it should only be used if there
is a real need. It's purpose is similar to template_preprocess().

- MODULE_preprocess_HOOK(&$variables)
This is for modules that want to alter or provide extra variables for
theming hooks not registered to itself. For example, if a module named
"foo" wanted to alter the $submitted variable for the hook "node" a
preprocess function of foo_preprocess_node() can be created to intercept
and alter the variable.

- ENGINE_engine_preprocess(&$variables, $hook)
This function should only be implemented by theme engines and exists
so that it can set necessary variables for all hooks.

- ENGINE_engine_preprocess_HOOK(&$variables)
This is the same as the previous function, but it is called for a single
theming hook.

- ENGINE_preprocess(&$variables, $hook)
This is meant to be used by themes that utilize a theme engine. It is
provided so that the preprocessor is not locked into a specific theme.
This makes it easy to share and transport code but theme authors must be
careful to prevent fatal re-declaration errors when using sub-themes that
have their own preprocessor named exactly the same as its base theme. In
the default theme engine (PHPTemplate), sub-themes will load their own
template.php file in addition to the one used for its parent theme. This
increases the risk for these errors. A good practice is to use the engine
name for the base theme and the theme name for the sub-themes to minimize
this possibility.

- ENGINE_preprocess_HOOK(&$variables)
The same applies from the previous function, but it is called for a
specific hook.

- THEME_preprocess(&$variables, $hook)
These functions are based upon the raw theme; they should primarily be
used by themes that do not use an engine or by sub-themes. It serves the
same purpose as ENGINE_preprocess().

- THEME_preprocess_HOOK(&$variables)
The same applies from the previous function, but it is called for a
specific hook.

There are two special variables that these hooks can set:
'template_file' and 'template_files'. These will be merged together
to form a list of 'suggested' alternate template files to use, in
reverse order of priority. template_file will always be a higher
priority than items in template_files. theme() will then look for these
files, one at a time, and use the first one
that exists.
param: $hook
param: ...
return:

drupal_discover_template($paths, $suggestions, $extension = '.tpl.php')   X-Ref
Choose which template file to actually render. These are all suggested
templates from themes and modules. Theming implementations can occur on
multiple levels. All paths are checked to account for this.


path_to_theme()   X-Ref
Return the path to the current themed element.

It can point to the active theme or the module handling a themed implementation.
For example, when invoked within the scope of a theming call it will depend
on where the theming function is handled. If implemented from a module, it
will point to the module. If implemented from the active theme, it will point
to the active theme. When called outside the scope of a theming call, it will
always point to the active theme.

drupal_find_theme_functions($cache, $prefixes)   X-Ref
Find overridden theme functions. Called by themes and/or theme engines to
easily discover theme functions.

param: $cache
param: $prefixes
return: $templates

drupal_find_theme_templates($cache, $extension, $path)   X-Ref
Find overridden theme templates. Called by themes and/or theme engines to
easily discover templates.

param: $cache
param: $extension
param: $path

theme_get_settings($key = NULL)   X-Ref
Retrieve an associative array containing the settings for a theme.

The final settings are arrived at by merging the default settings,
the site-wide settings, and the settings defined for the specific theme.
If no $key was specified, only the site-wide theme defaults are retrieved.

The default values for each of settings are also defined in this function.
To add new settings, add their default values here, and then add form elements
to system_theme_settings() in system.module.

param: $key
return:

theme_get_setting($setting_name, $refresh = FALSE)   X-Ref
Retrieve a setting for the current theme.
This function is designed for use from within themes & engines
to determine theme settings made in the admin interface.

Caches values for speed (use $refresh = TRUE to refresh cache)

param: $setting_name
param: $refresh
return:

theme_render_template($template_file, $variables)   X-Ref
Render a system default template, which is essentially a PHP template.

param: $template_file
param: $variables
return:

theme_placeholder($text)   X-Ref
Formats text for emphasized display in a placeholder inside a sentence.
Used automatically by t().

param: $text
return:

theme_status_messages($display = NULL)   X-Ref
Return a themed set of status and/or error messages. The messages are grouped
by type.

param: $display
return:

theme_links($links, $attributes = array('class' => 'links')   X-Ref
Return a themed set of links.

param: $links
param: $attributes
return:

theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE)   X-Ref
Return a themed image.

param: $path
param: $alt
param: $title
param: $attributes
param: $getsize
return:

theme_breadcrumb($breadcrumb)   X-Ref
Return a themed breadcrumb trail.

param: $breadcrumb
return: a string containing the breadcrumb output.

theme_help()   X-Ref
Return a themed help message.

return: a string containing the helptext for the current page.

theme_submenu($links)   X-Ref
Return a themed submenu, typically displayed under the tabs.

param: $links

theme_table($header, $rows, $attributes = array()   X-Ref
Return a themed table.

param: $header
param: $rows
param: $attributes
param: $caption
return:

theme_table_select_header_cell()   X-Ref
Returns a header cell for tables that have a select all functionality.


theme_tablesort_indicator($style)   X-Ref
Return a themed sort icon.

param: $style
return:

theme_box($title, $content, $region = 'main')   X-Ref
Return a themed box.

param: $title
param: $content
param: $region
return:

theme_mark($type = MARK_NEW)   X-Ref
Return a themed marker, useful for marking new or updated
content.

param: $type
return:

theme_item_list($items = array()   X-Ref
Return a themed list of items.

param: $items
param: $title
param: $type
param: $attributes
return:

theme_more_help_link($url)   X-Ref
Returns code that emits the 'more help'-link.


theme_xml_icon($url)   X-Ref
Return code that emits an XML icon.

For most use cases, this function has been superseded by theme_feed_icon().

param: $url

theme_feed_icon($url, $title)   X-Ref
Return code that emits an feed icon.

param: $url
param: $title

theme_more_link($url, $title)   X-Ref
Returns code that emits the 'more' link used on blocks.

param: $url
param: $title

theme_closure($main = 0)   X-Ref
Execute hook_footer() which is run at the end of the page right before the
close of the body tag.

param: $main (optional)
return:

theme_blocks($region)   X-Ref
Return a set of blocks available for the current user.

param: $region
return:

theme_username($object)   X-Ref
Format a username.

param: $object
return:

theme_progress_bar($percent, $message)   X-Ref
Return a themed progress bar.

param: $percent
param: $message
return:

theme_indentation($size = 1)   X-Ref
Create a standard indentation div. Used for drag and drop tables.

param: $size
return:

_theme_table_cell($cell, $header = FALSE)   X-Ref
@} End of "defgroup themeable".


template_preprocess(&$variables, $hook)   X-Ref
Adds a default set of helper variables for preprocess functions and
templates. This comes in before any other preprocess function which makes
it possible to be used in default theme implementations (non-overriden
theme functions).


template_preprocess_page(&$variables)   X-Ref
Process variables for page.tpl.php

Most themes utilize their own copy of page.tpl.php. The default is located
inside "modules/system/page.tpl.php". Look in there for the full list of
variables.

Uses the arg() function to generate a series of page template suggestions
based on the current path.

Any changes to variables in this preprocessor should also be changed inside
template_preprocess_maintenance_page() to keep all them consistent.

The $variables array contains the following arguments:
- $content
- $show_blocks


template_preprocess_node(&$variables)   X-Ref
Process variables for node.tpl.php

Most themes utilize their own copy of node.tpl.php. The default is located
inside "modules/node/node.tpl.php". Look in there for the full list of
variables.

The $variables array contains the following arguments:
- $node
- $teaser
- $page


template_preprocess_block(&$variables)   X-Ref
Process variables for block.tpl.php

Prepare the values passed to the theme_block function to be passed
into a pluggable template engine. Uses block properties to generate a
series of template file suggestions. If none are found, the default
block.tpl.php is used.

Most themes utilize their own copy of block.tpl.php. The default is located
inside "modules/system/block.tpl.php". Look in there for the full list of
variables.

The $variables array contains the following arguments:
- $block




Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7