Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Translation of their own fields

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

Page: 1
Go to End
Author Topic: 991 Views
  • BangMan
    Avatar
    Community Member
    7 Posts

    Translation of their own fields Link to this post

    I created its type of the page:

    /**
    * Defines the NewsPage page type
    */
    class NewsPage extends Page {

       static $db = array(
          'Date' => 'Date',
    );

       static $has_one = array(
          'Photo' => 'Image',
       );

    As I can translate into russian language in Admin Panel this Fields: Date and Photo
       
       static $icon = "/themes/tutorial/images/treeicons/news";
       function getCMSFields() {
          $fields = parent::getCMSFields();

          $fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
          $fields->addFieldToTab('Root.Content.Main', new ImageField('Photo'), 'Content');
       
    return $fields;
       
       function fieldLabels() {
          $labels = parent::fieldLabels();
          
          $labels['Date'] = _t('NewsPage.DATE', "Val News Date");
                
          return $labels;
       }
    }

    }

    class NewsPage_Controller extends Page_Controller {

    }

    ?>

    Attached Files
    991 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.