def drupal_load(type_, name): """ Includes a file with the provided type and name. This prevents including a theme, engine, plugin, etc., more than once. @param type The type of item to load (i.e. theme, theme_engine, plugin). @param name The name of the item to load. @return TRUE if the item is loaded or has already been loaded. """ php.static(drupal_load, "files", {}) if not php.isset(drupal_load.files, type): drupal_load.files[type_] = {} if php.isset(drupal_load.files[type_], name): return True else: filename = drupal_get_filename(type_, name) if filename != False: lib_plugin.plugins[name] = DrupyImport.import_file(filename) drupal_load.files[type_][name] = True return True else: return False
def drupal_load(type_, name): """ Includes a file with the provided type and name. This prevents including a theme, engine, plugin, etc., more than once. @param type The type of item to load (i.e. theme, theme_engine, plugin). @param name The name of the item to load. @return TRUE if the item is loaded or has already been loaded. """ php.static(drupal_load, 'files', {}) if (not php.isset(drupal_load.files, type)): drupal_load.files[type_] = {} if (php.isset(drupal_load.files[type_], name)): return True else: filename = drupal_get_filename(type_, name) if (filename != False): lib_plugin.plugins[name] = DrupyImport.import_file(filename) drupal_load.files[type_][name] = True return True else: return False
def hook_init(template): file = php.dirname(template.filename) + '/template.py' if (php.file_exists(file)): lib_theme.processors['template'] = DrupyImport.import_file(file)