From cff57f9076dd160b2185895f7298d4acbc5b5bb3 Mon Sep 17 00:00:00 2001 From: javiexin Date: Wed, 28 Dec 2016 12:55:26 +0100 Subject: [ticket/14944] Add possibility to search for template loop indexes by key Adds a new function to the template interface, and implements it in the context class. The function returns the ordinal index for a specified key, with the same structure that the key for alter_block_array. Reuses same code. PHPBB3-14944 --- phpBB/phpbb/template/base.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/phpbb/template/base.php') diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index 9a40702ba8..bc0f022cc4 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -132,6 +132,14 @@ abstract class base implements template return $this->context->alter_block_array($blockname, $vararray, $key, $mode); } + /** + * {@inheritdoc} + */ + public function find_key_index($blockname, $key = false) + { + return $this->context->find_key_index($blockname, $key); + } + /** * Calls hook if any is defined. * -- cgit v1.2.1 From 849fd9df7d9b2e449801e14ef54584fc8e063d43 Mon Sep 17 00:00:00 2001 From: javiexin Date: Sat, 28 Jan 2017 21:34:08 +0100 Subject: [ticket/14944] Add possibility to search for template loop indexes by key Adds a new function to the template interface, and implements it in the context class. The function returns the ordinal index for a specified key, with the same structure that the key for alter_block_array. Reuses same code. Remove unneeded references, do nothing for int keys. Check out of bounds or wrong blockname errors. Added tests. Remove default parameter value. PHPBB3-14944 --- phpBB/phpbb/template/base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/template/base.php') diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index bc0f022cc4..41c0a01ba8 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -135,7 +135,7 @@ abstract class base implements template /** * {@inheritdoc} */ - public function find_key_index($blockname, $key = false) + public function find_key_index($blockname, $key) { return $this->context->find_key_index($blockname, $key); } -- cgit v1.2.1