Fix form template issues (help texts, undefined template variables, etc.)

This commit is contained in:
Jens Schuppe 2024-09-11 13:19:54 +02:00
parent 7cca29b458
commit 4ae20a1b04
4 changed files with 32 additions and 36 deletions

View file

@ -29,16 +29,16 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form {
* List of all settings options.
*/
public static $SETTINGS_LIST = [
'twingle_prefix',
'twingle_use_sepa',
'twingle_dont_use_reference',
'twingle_protect_recurring',
'twingle_protect_recurring_activity_type',
'twingle_protect_recurring_activity_subject',
'twingle_protect_recurring_activity_status',
'twingle_protect_recurring_activity_assignee',
'twingle_use_shop',
'twingle_access_key',
'twingle_prefix',
'twingle_use_sepa',
'twingle_dont_use_reference',
'twingle_protect_recurring',
'twingle_protect_recurring_activity_type',
'twingle_protect_recurring_activity_subject',
'twingle_protect_recurring_activity_status',
'twingle_protect_recurring_activity_assignee',
'twingle_use_shop',
'twingle_access_key',
];
/**
@ -110,22 +110,22 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form {
$this->add(
'checkbox',
'twingle_use_shop',
E::ts("Use Twingle Shop Integration")
E::ts('Use Twingle Shop Integration')
);
$this->add(
'text',
'twingle_access_key',
E::ts("Twingle Access Key")
E::ts('Twingle Access Key')
);
$this->addButtons(array(
array (
'type' => 'submit',
'name' => E::ts('Save'),
'isDefault' => TRUE,
)
));
$this->addButtons([
[
'type' => 'submit',
'name' => E::ts('Save'),
'isDefault' => TRUE,
],
]);
// set defaults
foreach (self::$SETTINGS_LIST as $setting) {
@ -164,7 +164,7 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form {
CRM_Utils_Array::value('twingle_use_shop', $this->_submitValues) &&
!CRM_Utils_Array::value('twingle_access_key', $this->_submitValues, FALSE)
) {
$this->_errors['twingle_access_key'] = E::ts("An Access Key is required to enable Twingle Shop Integration");
$this->_errors['twingle_access_key'] = E::ts('An Access Key is required to enable Twingle Shop Integration');
}
return (0 == count($this->_errors));

View file

@ -91,7 +91,7 @@
{/htxt}
{htxt id='id-shop_map_products'}
<p>{ts domain="de.systopia.twingle"}If this option is enabled, all Twingle Shop products corresponding to the specified project IDs will be retrieved from Twingle and mapped as price sets and price fields. Each Twingle Shop is mapped as a price set with its products as price fields.</p>
<p>This allows you to manually create contributions with the same line items for phone orders, for example, as would be the case for orders placed through the Twingle Shop.</p>
<p>{ts domain="de.systopia.twingle"}If this option is enabled, all Twingle Shop products corresponding to the specified project IDs will be retrieved from Twingle and mapped as price sets and price fields. Each Twingle Shop is mapped as a price set with its products as price fields.{/ts}</p>
<p>{ts domain="de.systopia.twingle"}This allows you to manually create contributions with the same line items for phone orders, for example, as would be the case for orders placed through the Twingle Shop.{/ts}</p>
{/htxt}
{/crmScope}

View file

@ -31,3 +31,7 @@
{htxt id='id-twingle_use_shop'}
{ts domain="de.systopia.twingle"}If you enable Twingle Shop integration, you can configure Twingle API profiles to include products ordered through Twingle Shop as line items in the created contribution.{/ts}
{/htxt}
{htxt id='id-twingle_access_key'}
{ts domain="de.systopia.twingle"}Enter your twingle API access key.{/ts}
{/htxt}

View file

@ -89,24 +89,16 @@
<table class="form-layout-compressed">
<tr class="crm-twingle-form-block-use-shop">
<td class="label">{$form.twingle_use_shop.label}&nbsp;&nbsp;<a onclick='CRM.help("{$form.twingle_use_shop.label}", {literal}{"id":"id-{/literal}{$form.twingle_use_shop.name}{literal}","file":"CRM\/Twingle\/Form\/Settings"}{/literal}); return false;' href="#" title="{ts domain="de.systopia.twingle"}Help{/ts}" class="helpicon"></a></td>
<td>
{$form.twingle_use_shop.html}
<br />
<span class="description">
{$formElements.twingle_use_shop.description}
</span>
<td class="label">{$form.twingle_use_shop.label}
{help id="id-twingle_use_shop" title=$form.twingle_use_shop.label}
</td>
<td>{$form.twingle_use_shop.html}</td>
</tr>
<tr class="crm-twingle-form-block-access-key twingle-shop-element">
<td class="label">{$form.twingle_access_key.label}&nbsp;&nbsp;<a onclick='CRM.help("{$form.twingle_access_key.label}", {literal}{"id":"id-{/literal}{$form.twingle_access_key.name}{literal}","file":"CRM\/Twingle\/Form\/Settings"}{/literal}); return false;' href="#" title="{ts domain="de.systopia.twingle"}Help{/ts}" class="helpicon"></a></td>
<td>
{$form.twingle_access_key.html}
<br />
<span class="description">
{$formElements.twingle_access_key.description}
</span>
<td class="label">{$form.twingle_access_key.label}
{help id="id-twingle_access_key" title=$form.twingle_access_key.label}
</td>
<td>{$form.twingle_access_key.html}</td>
</tr>
</table>