diff options
author | javiexin <javiexin@gmail.com> | 2017-01-28 21:34:08 +0100 |
---|---|---|
committer | javiexin <javiexin@gmail.com> | 2017-01-28 21:34:08 +0100 |
commit | 849fd9df7d9b2e449801e14ef54584fc8e063d43 (patch) | |
tree | 233c7bb52c1222aea81885f83e4e49d633ba13e2 /phpBB/phpbb | |
parent | 20c03cccdde2302412d1e14adda370e7eb57b8e8 (diff) | |
download | forums-849fd9df7d9b2e449801e14ef54584fc8e063d43.tar forums-849fd9df7d9b2e449801e14ef54584fc8e063d43.tar.gz forums-849fd9df7d9b2e449801e14ef54584fc8e063d43.tar.bz2 forums-849fd9df7d9b2e449801e14ef54584fc8e063d43.tar.xz forums-849fd9df7d9b2e449801e14ef54584fc8e063d43.zip |
[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
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/template/base.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/template/context.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/template/template.php | 2 |
3 files changed, 3 insertions, 3 deletions
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); } diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 8bfbd73f1a..e70d0574be 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -278,7 +278,7 @@ class context * * @return mixed false if not found, index position otherwise; be sure to test with === */ - public function find_key_index($blockname, $key = false) + public function find_key_index($blockname, $key) { // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 $blocks = explode('.', $blockname); diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index b5a6ab32dc..9e3d658ca8 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -187,7 +187,7 @@ interface template * * @return mixed false if not found, index position otherwise; be sure to test with === */ - public function find_key_index($blockname, $key = false); + public function find_key_index($blockname, $key); /** * Get path to template for handle (required for BBCode parser) |