Package base :: Package themes :: Package engines :: Package drupytemplate
[hide private]

Source Code for Package base.themes.engines.drupytemplate

 1  #!/usr/bin/env python 
 2  # $Id: phptemplate.engine,v 1.70 2008/04/14 17:48:45 dries Exp $ 
 3   
 4  """ 
 5    Handles integration of templates written in pure php 
 6    with the Drupal theme system. 
 7   
 8    @package includes 
 9    @see <a href='http://drupy.net'>Drupy Homepage</a> 
10    @see <a href='http://drupal.org'>Drupal Homepage</a> 
11    @note Drupy is a port of the Drupal project. 
12    @note This file was ported from Drupal's includes/module.inc 
13    @author Brendon Crawford 
14    @copyright 2008 Brendon Crawford 
15    @contact message144 at users dot sourceforge dot net 
16    @created 2008-01-10 
17    @version 0.1 
18    @note License: 
19   
20      This program is free software; you can redistribute it and/or 
21      modify it under the terms of the GNU General Public License 
22      as published by the Free Software Foundation; either version 2 
23      of the License, or (at your option) any later version. 
24   
25      This program is distributed in the hope that it will be useful, 
26      but WITHOUT ANY WARRANTY; without even the implied warranty of 
27      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
28      GNU General Public License for more details. 
29   
30      You should have received a copy of the GNU General Public License 
31      along with this program; if not, write to: 
32       
33      The Free Software Foundation, Inc., 
34      51 Franklin Street, Fifth Floor, 
35      Boston, MA  02110-1301, 
36      USA 
37  """ 
38   
39  __version__ = "$Revision: 1 $" 
40   
41  from lib.drupy import DrupyPHP as php 
42  from lib.drupy import DrupyImport 
43  from includes import theme as lib_theme 
44   
45 -def hook_init(template):
46 file = php.dirname(template.filename) + '/template.py' 47 if (php.file_exists(file)): 48 lib_theme.processors['template'] = DrupyImport.import_file(file)
49 50 51
52 -def hook_theme(existing, type_, this_theme, path_):
53 """ 54 Implementation of hook_theme to tell Drupal what templates the engine 55 and the current theme use. The existing argument will contain hooks 56 pre-defined by Drupal so that we can use that information if 57 we need to. 58 """ 59 templates = drupal_find_theme_functions(existing, ('drupytemplate', this_theme)); 60 templates += drupal_find_theme_templates(existing, '.tpl.php', path_); 61 return templates
62