3
votes

In the back-end, the SilverStripe Fluent module adds a green flag icon to indicate the field is translatable (as seen next to PageName, URL Segment and Content).

This is a userfriendly detail and I would expect it work for custom added CMS Fields which are made translatable. For example, I've added a custom field named Introduction and made it translatable using: private static $translate = array( 'Introduction' ); But there is no green icon next to it. Can this be added?

No green icon next to image

1
Can you share your fluent yaml config? - scrowler
Sure, this one mysite/config/Fluent.yml right? Here it is: gist.github.com/Faloude/118c7a798f7f96928f508bd96f1292e3 - Semicolon
And this is one is fluent/_config/fluent.yml: gist.github.com/Faloude/df1d056036c0bdbe9557916fbc8acc35 - Semicolon
You need to apply the FluentExtension to your DataObject in your mysite fluent.yml - scrowler
does your getCMSFields $this->extend('updateCMSFields', $fields);? See [link]github.com/tractorcow/silverstripe-fluent/blob/master/docs/en/… - munomono

1 Answers

5
votes

It was necessary to add $this->beforeUpdateCMSFields(function($fields) { ... } BEFORE $fields = parent::getCMSFields(); and put all translatable fields in there like so:

function getCMSFields() {

    //This needs to be added for Fluent to apply css
    $this->beforeUpdateCMSFields(function($fields) {
        //Translatable field
        $fields->addFieldToTab("Root.Main", new TextAreaField('Introduction','Introduction'), 'Content');
    });

    $fields = parent::getCMSFields();

    //Non-translatable field
    $fields->addFieldToTab("Root.Main", $uploadField = new UploadField('Slideshow', 'Slideshow Images'), 'Content');

    return $fields;
}