1 <?php
2
3 class Person extends DataObject {
4 static $db = array(
5 'FIO' => 'Varchar(255)',
6 'Date1' => 'Varchar',
7 'Date2' => 'Varchar',
8 );
9
10 static $has_one = array(
11 'Photo' => 'Image',
12 'OrderItem' => 'OrderItem',
13 );
14
15 static $summary_fields = array('FIO', 'Date1', 'Date2');
16
17 function getCMSFields() {
18 $fields = parent::getCMSFields();
19
20 if ($this->PhotoID && ($portrait = $this->Photo()) && $portrait->ID) {
21 $fields->insertAfter(new LiteralField('PortraitImageLink', '<a href="'.$portrait->getAbsoluteURL().'">Загрузить</a>'), 'Photo');
22 }
23
24
25
26 return $fields;
27 }
28 }
[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.
-