From e9b8e0edbb612a4b93438d0f07e748f050220cdd Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 22 Nov 2021 19:08:33 +1300 Subject: [PATCH] Remove a bunch of isset from options.tpl --- CRM/Admin/Page/Options.php | 13 ++++--------- templates/CRM/Admin/Page/Options.tpl | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/CRM/Admin/Page/Options.php b/CRM/Admin/Page/Options.php index fec5b85999..4b2cf8587b 100644 --- a/CRM/Admin/Page/Options.php +++ b/CRM/Admin/Page/Options.php @@ -95,9 +95,6 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic { self::$_gLabel = ts('Option'); } - $this->assign('gName', self::$_gName); - $this->assign('gLabel', self::$_gLabel); - if (self::$_gName == 'acl_role') { CRM_Utils_System::setTitle(ts('Manage ACL Roles')); // set breadcrumb to append to admin/access @@ -128,14 +125,12 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic { ] )); - if (self::$_gName == 'participant_role') { - $this->assign('showCounted', TRUE); - } + $this->assign('showCounted', self::$_gName === 'participant_role'); $this->assign('isLocked', self::$_isLocked); $this->assign('allowLoggedIn', Civi::settings()->get('allow_mail_from_logged_in_contact')); - if (self::$_gName == 'activity_type') { - $this->assign('showComponent', TRUE); - } + $this->assign('showComponent', self::$_gName === 'activity_type'); + $this->assign('gName', self::$_gName); + $this->assign('gLabel', self::$_gLabel); } /** diff --git a/templates/CRM/Admin/Page/Options.tpl b/templates/CRM/Admin/Page/Options.tpl index 0e7e5bab47..f08d6baad9 100644 --- a/templates/CRM/Admin/Page/Options.tpl +++ b/templates/CRM/Admin/Page/Options.tpl @@ -8,7 +8,7 @@ +--------------------------------------------------------------------+ *} -{if empty($gName)} +{if !$gName} {include file="CRM/Admin/Page/OptionGroup.tpl"} {elseif $action eq 1 or $action eq 2 or $action eq 8} @@ -48,7 +48,7 @@ {else} {ts}You can use this page to define one or more general Email Addresses that can be selected as the From Address. EXAMPLE: "Client Services" <clientservices@example.org>{/ts} {/if} - {elseif !empty($isLocked)} + {elseif $isLocked} {ts}This option group is reserved for system use. You cannot add or delete options in this list.{/ts} {else} {ts 1=$gLabel}The existing option choices for %1 group are listed below. You can add, edit or delete them from this screen.{/ts} @@ -58,11 +58,11 @@
{if $rows} -{if !isset($isLocked) || $isLocked ne 1} + {if $isLocked ne 1} -{/if} + {/if} {foreach from=$rows item=row} {if !empty($row.icon)}{assign var='hasIcons' value=TRUE}{/if} {/foreach} @@ -76,7 +76,7 @@ {if !empty($hasIcons)} {/if} - {if !empty($showComponent)} + {if $showComponent} {ts}Component{/ts} {/if} @@ -101,10 +101,10 @@ {/if} {if $gName eq "payment_instrument"}{ts}Account{/ts}{/if} - {if !empty($showCounted)}{ts}Counted?{/ts}{/if} + {if $showCounted}{ts}Counted?{/ts}{/if} {ts}Description{/ts} {ts}Order{/ts} - {if !empty($showIsDefault)}{ts}Default{/ts}{/if} + {if $showIsDefault}{ts}Default{/ts}{/if} {ts}Reserved{/ts} {ts}Enabled?{/ts} @@ -116,7 +116,7 @@ {if !empty($hasIcons)} {/if} - {if !empty($showComponent)} + {if $showComponent} {$row.component_name} {/if} @@ -129,12 +129,12 @@ {if $gName eq "payment_instrument"} {$row.financial_account} {/if} - {if !empty($showCounted)} + {if $showCounted} {icon condition=$row.filter}{ts}Counted{/ts}{/icon} {/if} {if isset($row.description)}{$row.description}{/if} {if isset($row.weight)}{$row.weight}{/if} - {if !empty($showIsDefault)} + {if $showIsDefault} {if !empty($row.is_default)}{icon}{ts}Default{/ts}{/icon}{/if}  {/if} {if $row.is_reserved eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if} @@ -154,8 +154,8 @@
{/if} -- 2.25.1