Version: current

     1 <?php
     2 /*
     3  * Раздел "Номерной фонд". Может содержать как вложенные разделы (RoomCatalog), так и номера (Room)
     4  *
     5  * @author menedem
     6  */
     7 class RoomCatalog extends MediawebPage {
     8     static $allowed_children = array('Room', 'RoomCatalog', 'BookingPage');
     9     static $default_parent = 'RoomCatalog';
    10
    11     static $has_one = array(
    12         'Icon' => 'Image'
    13     );
    14
    15     function getCMSFields() {
    16         $fields = parent::getCMSFields();
    17         $fields->addFieldToTab('Root.Content.Main', new ImageField('Icon', $this->fieldLabel('Icon')), 'Content');
    18         $fields->removeByName('CoverImageID');
    19         return $fields;
    20     }
    21
    22     /**
    23      * Возвращает список подрубрик
    24      *
    25      * @return DataObjectSet
    26      */
    27     public function Subcats() {
    28         return DataObject::get("RoomCatalog", "ParentID = {$this->ID} AND ShowInMenus=1");
    29     }
    30
    31     public function Rooms() {
    32         return DataObject::get("Room", "ParentID = {$this->ID}");
    33     }
    34
    35 }
    36
    37 class RoomCatalog_Controller extends MediawebPage_Controller {
    38
    39 }
    40

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