Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#527 Add in abiity to set translated text for Submit and Canc… #13185

Merged
merged 1 commit into from
Jan 4, 2019

Conversation

seamuslee001
Copy link
Contributor

…el button text

Overview

This adds in the ability for Users to set different text per language for these fields when editing the settings

Before

Could not enter different text per language

After

Can enter text per language

ping @eileenmcnaughton @samuelsov

@civibot
Copy link

civibot bot commented Nov 30, 2018

(Standard links)

@civibot civibot bot added the master label Nov 30, 2018
@eileenmcnaughton
Copy link
Contributor

Hmm - we are really moving toward using shared code for this sort of stuff - ie. per the entity settings form & the related Tpl

@seamuslee001
Copy link
Contributor Author

@eileenmcnaughton sure understand that but given this is an additional file that is bundled in (its an accordion on the profile setting page) i'm not sure how it would work on the entity setting form.

@eileenmcnaughton
Copy link
Contributor

@seamuslee001 so you can replace a part of a tpl with the standard field/s template like this - it permits some fields to be transitioned across without having to do the whole form. The key part is that all the metadata is in $fieldSpec before the {include file="CRM/Core/Form/Field.tpl"} is called

      {foreach from=$tpl_standardised_fields item=fieldName}
       {assign var=fieldSpec value=$entityFields.$fieldName}
       <tr class="crm-{$entityInClassFormat}-form-block-{$fieldName}">
          {include file="CRM/Core/Form/Field.tpl"}
        </tr>
      {/foreach}

@eileenmcnaughton
Copy link
Contributor

Obviously you need to assign metadata to the tpl in some array - but that's kinda the point - the more we mature our metadata the better prepared we are to NOT be on QF anymore

@seamuslee001
Copy link
Contributor Author

@eileenmcnaughton ok i think i have it now it was a little tricky to ensure the fields didn't get displayed in the main part of the form

@@ -64,7 +64,9 @@ protected function setEntityFields() {
'title' => ['name' => 'title'],
'frontend_title' => ['name' => 'frontend_title'],
'description' => ['name' => 'description', 'help' => ['id' => 'id-description', 'file' => 'CRM/UF/Form/Group.hlp']],
'uf_group_type' => ['name' => 'uf_group_type', 'not-auto-addable' => TRUE, 'help' => ['id' => 'id-used_for', 'file' => 'CRM/UF/Form/Group.hlp'], 'post_html_text' => ' ' . $this->getOtherModuleString()]
'uf_group_type' => ['name' => 'uf_group_type', 'not-auto-addable' => TRUE, 'help' => ['id' => 'id-used_for', 'file' => 'CRM/UF/Form/Group.hlp'], 'post_html_text' => ' ' . $this->getOtherModuleString()],
'cancel_button_text' => ['name' => 'cancel_button_text', 'help' => ['id' => 'id-cancel_button_text', 'file' => 'CRM/UF/Form/Group.hlp'], 'class' => 'cancel_button_section'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton note the class here is because of some javascript that hides all cancel button sections if the show cancel button field is not checked

<tr class="crm-{$entityInClassFormat}-form-block-{$fieldName}">
{include file="CRM/Core/Form/Field.tpl"}
</tr>
{if not in_array($fieldSpec.name, $advancedFieldsConverted)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures that the new fields don't show on the main part of the form as well as on the advanced settings section

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not hugely important but I think !in_array would be more consistent with elsewhere than 'not'

…el button text

Convert to using entity fields style adding to form
@seamuslee001
Copy link
Contributor Author

Jenkins re test this please

@eileenmcnaughton
Copy link
Contributor

I just tested this & it works well. Code looks good. Merge on pass

@seamuslee001
Copy link
Contributor Author

thanks @eileenmcnaughton

@seamuslee001
Copy link
Contributor Author

Merging as per the tag

@seamuslee001 seamuslee001 merged commit 3791b49 into civicrm:master Jan 4, 2019
@eileenmcnaughton eileenmcnaughton deleted the lab_core_572 branch January 6, 2019 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants