1 <?php
2
3 class MobileContentDecorator extends DataObjectDecorator {
4 function () {
5 return array(
6 'db' => array(
7 'MobileContent' => 'HTMLText'
8 )
9 );
10 }
11
12 function updateCMSFields(& $fields) {
13 $fields->insertAfter(new Tab('Mobile', _t('Mobile.tab_MobileContent')), 'Main');
14 $fields->addFieldToTab('Root.Content.Mobile', new HTMLEditorField('MobileContent', $this->owner->fieldLabel('MobileContent')));
15 }
16
17 function MobContent() {
18 return DBField::create('HTMLText', $this->owner->Content);
19 }
20
21 22 23 24 25
26 function contentcontrollerInit(& $controller) {
27 if (MobileExtension::is_mobile_domain()) {
28 SSViewer::set_theme(MobileExtension::get_mobile_theme());
29 if ($this->owner->MobileContent)
30 $this->owner->Content = $this->owner->MobileContent;
31 }
32 }
33 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-