Version: current

     1 <?php
     2
     3 class PhotoAlbumProductLinkDecorator extends DataObjectDecorator {
     4     function extraStatics() {
     5         return array(
     6             'has_one' => array(
     7                 'LinkedProduct' => 'Product',
     8             ),
     9         );
    10     }
    11
    12     function updateCMSFields(& $fields) {
    13         if ($projects = DataObject::get('Product')) {
    14             // FIXME выбор из дерева
    15             $fields->addFieldToTab(
    16                 'Root.Content.Main',
    17                 new DropdownField('LinkedProductID', $this->owner->fieldLabel('LinkedProduct'), $projects->map('ID', 'Title', 'не выбрано')),
    18                 'Content'
    19             );
    20         }
    21     }
    22 }

[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. -