Merge branch 'formTemplates'

[#100] Fix form template issues (help texts, undefined template variables, etc.)
This commit is contained in:
Jens Schuppe 2024-09-24 14:26:11 +02:00
commit 2834f8028d
4 changed files with 32 additions and 36 deletions

View file

@ -110,22 +110,22 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form {
$this->add( $this->add(
'checkbox', 'checkbox',
'twingle_use_shop', 'twingle_use_shop',
E::ts("Use Twingle Shop Integration") E::ts('Use Twingle Shop Integration')
); );
$this->add( $this->add(
'text', 'text',
'twingle_access_key', 'twingle_access_key',
E::ts("Twingle Access Key") E::ts('Twingle Access Key')
); );
$this->addButtons(array( $this->addButtons([
array ( [
'type' => 'submit', 'type' => 'submit',
'name' => E::ts('Save'), 'name' => E::ts('Save'),
'isDefault' => TRUE, 'isDefault' => TRUE,
) ],
)); ]);
// set defaults // set defaults
foreach (self::$SETTINGS_LIST as $setting) { 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_use_shop', $this->_submitValues) &&
!CRM_Utils_Array::value('twingle_access_key', $this->_submitValues, FALSE) !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)); return (0 == count($this->_errors));

View file

@ -91,7 +91,7 @@
{/htxt} {/htxt}
{htxt id='id-shop_map_products'} {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>{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>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"}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} {/htxt}
{/crmScope} {/crmScope}

View file

@ -31,3 +31,7 @@
{htxt id='id-twingle_use_shop'} {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} {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}
{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"> <table class="form-layout-compressed">
<tr class="crm-twingle-form-block-use-shop"> <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 class="label">{$form.twingle_use_shop.label}
<td> {help id="id-twingle_use_shop" title=$form.twingle_use_shop.label}
{$form.twingle_use_shop.html}
<br />
<span class="description">
{$formElements.twingle_use_shop.description}
</span>
</td> </td>
<td>{$form.twingle_use_shop.html}</td>
</tr> </tr>
<tr class="crm-twingle-form-block-access-key twingle-shop-element"> <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 class="label">{$form.twingle_access_key.label}
<td> {help id="id-twingle_access_key" title=$form.twingle_access_key.label}
{$form.twingle_access_key.html}
<br />
<span class="description">
{$formElements.twingle_access_key.description}
</span>
</td> </td>
<td>{$form.twingle_access_key.html}</td>
</tr> </tr>
</table> </table>