From 4a9538ac06a0439a54c463d053fa2969d0dacb99 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 29 Oct 2013 14:55:22 -0700 Subject: [PATCH] CRM-13674 - CRM_Core_* - Add smarty functions --- CRM/Core/Controller.php | 31 +++++++++++++++++++++++++++++++ CRM/Core/Form.php | 22 ++++++++++++++++++++++ CRM/Core/Page.php | 22 ++++++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index 22a5bf579c..21a4ac461b 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -604,10 +604,41 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { self::$_template->assign($var, $value); } + /** + * assign value to name in template by reference + * + * @param array|string $name name of variable + * @param mixed $value (reference) value of varaible + * + * @return void + * @access public + */ function assign_by_ref($var, &$value) { self::$_template->assign_by_ref($var, $value); } + /** + * appends values to template variables + * + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to append + * @param bool $merge + */ + function append($tpl_var, $value=NULL, $merge=FALSE) { + self::$_template->append($tpl_var, $value, $merge); + } + + /** + * Returns an array containing template variables + * + * @param string $name + * @param string $type + * @return array + */ + function get_template_vars($name=null) { + return self::$_template->get_template_vars($name); + } + /** * setter for embedded * diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 5fcc342d2d..91728c21be 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -720,6 +720,28 @@ class CRM_Core_Form extends HTML_QuickForm_Page { self::$_template->assign_by_ref($var, $value); } + /** + * appends values to template variables + * + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to append + * @param bool $merge + */ + function append($tpl_var, $value=NULL, $merge=FALSE) { + self::$_template->append($tpl_var, $value, $merge); + } + + /** + * Returns an array containing template variables + * + * @param string $name + * @param string $type + * @return array + */ + function get_template_vars($name=null) { + return self::$_template->get_template_vars($name); + } + function &addRadio($name, $title, &$values, $attributes = NULL, $separator = NULL, $required = FALSE) { $options = array(); if (empty($attributes)) { diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index 3d74a087dd..95ff557578 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -273,6 +273,28 @@ class CRM_Core_Page { self::$_template->assign_by_ref($var, $value); } + /** + * appends values to template variables + * + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to append + * @param bool $merge + */ + function append($tpl_var, $value=NULL, $merge=FALSE) { + self::$_template->append($tpl_var, $value, $merge); + } + + /** + * Returns an array containing template variables + * + * @param string $name + * @param string $type + * @return array + */ + function get_template_vars($name=null) { + return self::$_template->get_template_vars($name); + } + /** * function to destroy all the session state of this page. * -- 2.25.1