Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176
This commit is contained in:
commit
9921556621
13277 changed files with 1459781 additions and 0 deletions
58
core/themes/engines/phptemplate/phptemplate.engine
Normal file
58
core/themes/engines/phptemplate/phptemplate.engine
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Handles integration of PHP templates with the Drupal theme system.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Extension\Extension;
|
||||
|
||||
/**
|
||||
* Implements hook_init().
|
||||
*/
|
||||
function phptemplate_init(Extension $theme) {
|
||||
$theme->load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
function phptemplate_theme($existing, $type, $theme, $path) {
|
||||
$templates = drupal_find_theme_functions($existing, array($theme));
|
||||
$templates += drupal_find_theme_templates($existing, '.tpl.php', $path);
|
||||
return $templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_extension().
|
||||
*/
|
||||
function phptemplate_extension() {
|
||||
return '.tpl.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_render_template().
|
||||
*
|
||||
* Renders a system default template, which is essentially a PHP template.
|
||||
*
|
||||
* @param $template_file
|
||||
* The filename of the template to render.
|
||||
* @param $variables
|
||||
* A keyed array of variables that will appear in the output.
|
||||
*
|
||||
* @return
|
||||
* The output generated by the template.
|
||||
*/
|
||||
function phptemplate_render_template($template_file, $variables) {
|
||||
// Extract the variables to a local namespace
|
||||
extract($variables, EXTR_SKIP);
|
||||
|
||||
// Start output buffering
|
||||
ob_start();
|
||||
|
||||
// Include the template file
|
||||
include \Drupal::root() . '/' . $template_file;
|
||||
|
||||
// End buffering and return its contents
|
||||
return ob_get_clean();
|
||||
}
|
||||
5
core/themes/engines/phptemplate/phptemplate.info.yml
Normal file
5
core/themes/engines/phptemplate/phptemplate.info.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
type: theme_engine
|
||||
name: PHPTemplate
|
||||
core: 8.x
|
||||
version: VERSION
|
||||
package: Core
|
||||
Reference in a new issue