Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Need help with TranslatableDataObject

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 751 Views
  • Webdoc
    Avatar
    Community Member
    332 Posts

    Need help with TranslatableDataObject Link to this post

    added to config line:

    TranslatableDataObject::register('Referents', array(
    'Objektinimi',
    ));


    Im using ss2.4.10

    -------------------------------------------------------------------------------------------------------------
    Arvixe Web Hosting / SilverStripe Community Liaison | Looking for quality SilverStripe Web Hosting? Look no further than Arvixe Web Hosting!

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: Need help with TranslatableDataObject Link to this post

    tried with no luck

    <?php
    class Referents extends DataObject
    {
       static $db = array (
       'Objektinimi' => 'Text',
       'Aasta' => 'Text',
       'ObjektiKat' => "Enum('Pooleli,Valmis')",
       );
       static $has_one = array (
       'Reflist' => 'Reflist',
       'Photo' => 'Image'
       );
       static $default_sort = 'Aasta DESC';
       
       public function getCMSFields_forPopup()
       {
       $fields = new FieldSet(
          new TextField('Aasta', 'Aasta'),
          new TextField('Objektinimi', 'Objekti nimi'),
          new DropdownField('ObjektiKat','ObjektiKat',singleton('Referents')->dbObject('ObjektiKat')->enumValues()),
          new ImageField('Photo', 'Objekti pilt')
          );
    //replace the field with translation;
    $myfield = $this->getTranslationFields("Objektinimi");
    $fields->replaceField('Objektinimi',$myfield);
    return $fields;
       }
    }
    ?>


    -------------------------------------------------------------------------------------------------------------
    Arvixe Web Hosting / SilverStripe Community Liaison | Looking for quality SilverStripe Web Hosting? Look no further than Arvixe Web Hosting!

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: Need help with TranslatableDataObject Link to this post

    gives error in cms:

    ERROR [User Error]: Uncaught Exception: Object->__call(): the method 'gettranslationfields' does not exist on 'Referents'

    -------------------------------------------------------------------------------------------------------------
    Arvixe Web Hosting / SilverStripe Community Liaison | Looking for quality SilverStripe Web Hosting? Look no further than Arvixe Web Hosting!

    751 Views
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.