aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/template
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-03-10 23:49:37 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-03-10 23:49:37 +0100
commit235f7c3721f792e0f732ed086e1118a2f08e37a6 (patch)
treea8e34772c5f685b6b0ba3dc1e7b90c6db2f8457e /phpBB/phpbb/template
parentc169583dc3c551bc08fc217e0d5bb5dd6022ec57 (diff)
parentd29514f3e795374a653d3b9fa96c80dbefff449f (diff)
downloadforums-235f7c3721f792e0f732ed086e1118a2f08e37a6.tar
forums-235f7c3721f792e0f732ed086e1118a2f08e37a6.tar.gz
forums-235f7c3721f792e0f732ed086e1118a2f08e37a6.tar.bz2
forums-235f7c3721f792e0f732ed086e1118a2f08e37a6.tar.xz
forums-235f7c3721f792e0f732ed086e1118a2f08e37a6.zip
Merge remote-tracking branch 'rxu3/ticket/12224' into develop
* rxu3/ticket/12224: [ticket/12224] Add assign_block_vars_array() test. [ticket/12224] Add template wrapper method to assign block arrays
Diffstat (limited to 'phpBB/phpbb/template')
-rw-r--r--phpBB/phpbb/template/base.php10
-rw-r--r--phpBB/phpbb/template/context.php16
-rw-r--r--phpBB/phpbb/template/template.php8
3 files changed, 34 insertions, 0 deletions
diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php
index 6044effa1f..5bce79fd85 100644
--- a/phpBB/phpbb/template/base.php
+++ b/phpBB/phpbb/template/base.php
@@ -113,6 +113,16 @@ abstract class base implements template
/**
* {@inheritdoc}
*/
+ public function assign_block_vars_array($blockname, array $block_vars_array)
+ {
+ $this->context->assign_block_vars_array($blockname, $block_vars_array);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
{
return $this->context->alter_block_array($blockname, $vararray, $key, $mode);
diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php
index 0b929f4934..a222fbb69e 100644
--- a/phpBB/phpbb/template/context.php
+++ b/phpBB/phpbb/template/context.php
@@ -200,6 +200,22 @@ class context
}
/**
+ * Assign key variable pairs from an array to a whole specified block loop
+ *
+ * @param string $blockname Name of block to assign $block_vars_array to
+ * @param array $block_vars_array An array of hashes of variable name => value pairs
+ */
+ public function assign_block_vars_array($blockname, array $block_vars_array)
+ {
+ foreach ($block_vars_array as $vararray)
+ {
+ $this->assign_block_vars($blockname, $vararray);
+ }
+
+ return true;
+ }
+
+ /**
* Change already assigned key variable pair (one-dimensional - single loop entry)
*
* An example of how to use this function:
diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php
index d95b0a822c..87ae7a9766 100644
--- a/phpBB/phpbb/template/template.php
+++ b/phpBB/phpbb/template/template.php
@@ -132,6 +132,14 @@ interface template
public function assign_block_vars($blockname, array $vararray);
/**
+ * Assign key variable pairs from an array to a whole specified block loop
+ * @param string $blockname Name of block to assign $block_vars_array to
+ * @param array $block_vars_array An array of hashes of variable name => value pairs
+ * @return \phpbb\template\template $this
+ */
+ public function assign_block_vars_array($blockname, array $block_vars_array);
+
+ /**
* Change already assigned key variable pair (one-dimensional - single loop entry)
*
* An example of how to use this function: