Version: current

     1 <?php
     2
     3 /**
     4  * Настройки водяного знака
     5  *
     6  * @author inxo, menedem
     7  */
     8 class WatermarkSiteConfig extends SiteConfigDecorator {
     9
    10     function extraStatics() {
    11         return array(
    12             'db' => array(
    13                 'WatermarkPosition' => "enum('center, upperleft, upperright, lowerleft, lowerright')", // Положение водяного знака
    14             ),
    15             'has_one' => array(
    16                 'WatermarkImage' => 'Image', // Изображение водяного знака
    17             ),
    18             'defaults' => array(
    19                 'WatermarkPosition' => 'center'
    20             )
    21         );
    22     }
    23
    24     public function updateCMSFields(FieldSet &$fields) {
    25         $tab = SiteConfigDecorator::get_config_tab($fields, 'Watermark');
    26
    27         $tab->push(new ImageField('WatermarkImage', $this->owner->fieldLabel('WatermarkImage')));
    28
    29         $positions = singleton('SiteConfig')->dbObject('WatermarkPosition')->enumValues();
    30         $rs = array();
    31         foreach($positions as $position) {
    32             $rs[$position] = _t('SiteConfig.WatermarkPosition_' . $position, $position);
    33         }
    34         $tab->push(new DropDownField('WatermarkPosition', $this->owner->fieldLabel('WatermarkPosition'), $rs));
    35     }
    36
    37 }
    38

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