Jump to:

1160 Posts in 2632 Topics by 409 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » Translations for Userform

Ask questions about upgrading SilverStripe to the latest version.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 727 Views
  • ragunalth
    Community Member
    14 Posts

    Translations for Userform Link to this post

    Here is code to copy the form when creating a new language.

    Add the following function in userforms/code/UserDefinedForm.php

    function createTranslation($locale) {
    $page = parent::createTranslation($locale);

    $newPage = $page->getTranslation(Translatable::default_locale());
    foreach($newPage->Fields() as $field) {
    $newField = $field->duplicate();
    $newField->ParentID = $page->ID;
    foreach($newPage->EmailRecipients() as $recipient) {
    $newER = $recipient->duplicate();
    $newER->FormID = $page->ID;

    return $page;

    After this has been added you can create new languages on a page and it should copy your form over.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.