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 Permit translation of Public Title field for Profiles #13110

Merged
merged 2 commits into from
Nov 16, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Nov 15, 2018

Overview

Fixes the field 'Public Title' to be translatable on the profile form

Before

Not translatable

After

screenshot 2018-11-16 12 05 46

Technical Details

In order to fix this field I have partially converted the form to an EntityForm. To finish the form we probably need to figure out how to deal with the accordian in it - but I did look at one challenge - which was having a way to add some text after the html & before the
which I did in the tpl

Comments

@mattwire ping
@samuelsov this fixes one of the fields you describe in https://lab.civicrm.org/dev/core/issues/527
Note that the next field on the display is 'description' and that doesn't seem to be localised in the schema yet. I think there are some upgrade challenges in changing that

@civibot
Copy link

civibot bot commented Nov 15, 2018

(Standard links)

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

@mattwire mattwire left a comment

Choose a reason for hiding this comment

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

@eileenmcnaughton I've r-run this and done a code review. It works perfectly.

I have not tested this on a multilingual install and I don't quite understand how this makes the field translateable but I'm assuming that's part of the magic of entityform?

@@ -112,6 +120,9 @@
<type>int</type>
<required>true</required>
<default>1</default>
<html>
<type>Text</type>
</html>
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. All changes in UFGroup.xml are correct.

'description' => ts('Profile Form Public title'),
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
'table_name' => 'civicrm_uf_group',
'entity' => 'UFGroup',
'bao' => 'CRM_Core_BAO_UFGroup',
'localizable' => 1,
'html' => [
'type' => 'Text',
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. All changes in UFGroup.php are correct.

'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()]
];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

$otherModuleString .= " [ x ] <label>" . $key . "</label>";
}
$this->assign('otherModuleString', $otherModuleString);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. Moved to it's own function getOtherModuleString()

@eileenmcnaughton
Copy link
Contributor Author

merging based on @mattwire review

@mattwire yes the field level template for entity form looks at is_localizable & renders translation box if appropriate

@eileenmcnaughton eileenmcnaughton merged commit 36c5896 into civicrm:master Nov 16, 2018
@eileenmcnaughton eileenmcnaughton deleted the profile_translate branch November 16, 2018 20:34
@@ -33,7 +33,7 @@
{/capture}{help id=$help.id file=$help.file}{/if}
{if $action == 2 && $fieldSpec.is_add_translate_dialog}{include file='CRM/Core/I18n/Dialog.tpl' table=$entityTable field=$fieldName id=$entityID}{/if}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mattwire this line ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants