From dc5a48a14be8e37bf8e9b4ee18267fe76bb88ae7 Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Fri, 7 Jul 2023 08:47:16 -0400 Subject: [PATCH] backport 26763 --- templates/CRM/Contact/Form/Task/Batch.tpl | 6 ++---- templates/CRM/Custom/Form/Preview.tpl | 6 ++---- templates/CRM/Event/Form/Task/Batch.tpl | 6 ++---- templates/CRM/Profile/Form/Dynamic.tpl | 6 ++---- templates/CRM/UF/Form/Fields.tpl | 6 ++---- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/templates/CRM/Contact/Form/Task/Batch.tpl b/templates/CRM/Contact/Form/Task/Batch.tpl index 2cd61d93b1..418dd56c80 100644 --- a/templates/CRM/Contact/Form/Task/Batch.tpl +++ b/templates/CRM/Contact/Form/Task/Batch.tpl @@ -38,11 +38,9 @@ {* sort by fails for option per line. Added a variable to iterate through the element array*} - {assign var="index" value="1"} {foreach name=optionOuter key=optionKey item=optionItem from=$form.field.$cid.$n} - {if $index < 10} - {assign var="index" value=`$index+1`} - {else} + {* There are both numeric and non-numeric keys mixed in here, where the non-numeric are metadata that aren't arrays with html members. *} + {if is_array($optionItem) && array_key_exists('html', $optionItem)} {if $count == $field.options_per_line} diff --git a/templates/CRM/Custom/Form/Preview.tpl b/templates/CRM/Custom/Form/Preview.tpl index f4481271e8..592b916ea9 100644 --- a/templates/CRM/Custom/Form/Preview.tpl +++ b/templates/CRM/Custom/Form/Preview.tpl @@ -43,11 +43,9 @@
{$form.field.$cid.$n.$optionKey.html}
{* sort by fails for option per line. Added a variable to iterate through the element array*} - {assign var="index" value="1"} {foreach name=outer key=key item=item from=$form.$element_name} - {if $index < 10} - {assign var="index" value=`$index+1`} - {else} + {* There are both numeric and non-numeric keys mixed in here, where the non-numeric are metadata that aren't arrays with html members. *} + {if is_array($item) && array_key_exists('html', $item)} {if $count == $element.options_per_line} {assign var="count" value="1"} diff --git a/templates/CRM/Event/Form/Task/Batch.tpl b/templates/CRM/Event/Form/Task/Batch.tpl index 27760a6b08..a77ecf5f95 100644 --- a/templates/CRM/Event/Form/Task/Batch.tpl +++ b/templates/CRM/Event/Form/Task/Batch.tpl @@ -65,11 +65,9 @@
{$form.$element_name.$key.html}
{* sort by fails for option per line. Added a variable to iterate through the element array*} - {assign var="index" value="1"} {foreach name=optionOuter key=optionKey item=optionItem from=$form.field.$pid.$n} - {if $index < 10} - {assign var="index" value=`$index+1`} - {else} + {* There are both numeric and non-numeric keys mixed in here, where the non-numeric are metadata that aren't arrays with html members. *} + {if is_array($optionItem) && array_key_exists('html', $optionItem)} {if $count == $field.options_per_line} diff --git a/templates/CRM/Profile/Form/Dynamic.tpl b/templates/CRM/Profile/Form/Dynamic.tpl index eb2ef70c6a..3fd1036795 100644 --- a/templates/CRM/Profile/Form/Dynamic.tpl +++ b/templates/CRM/Profile/Form/Dynamic.tpl @@ -103,11 +103,9 @@
{$form.field.$pid.$n.$optionKey.html}
{* sort by fails for option per line. Added a variable to iterate through the element array*} - {assign var="index" value="1"} {foreach name=outer key=key item=item from=$form.$n} - {if $index < 10} - {assign var="index" value=`$index+1`} - {else} + {* There are both numeric and non-numeric keys mixed in here, where the non-numeric are metadata that aren't arrays with html members. *} + {if is_array($item) && array_key_exists('html', $item)} {if $count == $field.options_per_line} diff --git a/templates/CRM/UF/Form/Fields.tpl b/templates/CRM/UF/Form/Fields.tpl index b261f2dcbd..2dc383fda3 100644 --- a/templates/CRM/UF/Form/Fields.tpl +++ b/templates/CRM/UF/Form/Fields.tpl @@ -57,11 +57,9 @@
{$form.$n.$key.html}
{* sort by fails for option per line. Added a variable to iterate through the element array*} - {assign var="index" value="1"} {foreach name=outer key=key item=item from=$formElement} - {if $index < 10} - {assign var="index" value=`$index+1`} - {else} + {* There are both numeric and non-numeric keys mixed in here, where the non-numeric are metadata that aren't arrays with html members. *} + {if is_array($item) && array_key_exists('html', $item)} {if $count == $field.options_per_line} -- 2.25.1
{$formElement.$key.html}