Semicolon
Semicolon

Reputation: 1914

SilverStripe Fluent field icons

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

Upvotes: 3

Views: 367

Answers (1)

Semicolon
Semicolon

Reputation: 1914

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;
}

Upvotes: 5

Related Questions