Version: current

     1 <?php
     2 /**
     3  * Размер сечения цоколя
     4  *
     5  *
     6  *
     7  */
     8 class SocleSize extends Product {
     9
    10     static $many_many = array(
    11         'SocleSections' => 'SocleSection', // круговая
    12     );
    13
    14     static $many_many_extraFields = array(
    15         'SocleSections' => array(
    16             'Price' => 'CatalogPrice',
    17         ),
    18     );
    19
    20     function getCMSFields() {
    21         $fields = parent::getCMSFields();
    22         $tab = $fields->findOrMakeTab('Root.Content.Params', 'Параметры цоколя');
    23
    24         if ($sections = $this->getAllSocleSections()) {
    25             foreach($sections as $section) {
    26                 $tab->push(new SocleSize_SocleSectionTextField('SocleSections', $section));
    27             }
    28         }
    29         return $fields;
    30     }
    31
    32     function FullTitle() {
    33         return $this->renderWith('SocleSizeFullTitle');
    34     }
    35
    36     function getAllSocleSections() {
    37         if ($sections = SocleSection::get_sections()) {
    38             foreach ($this->SocleSections() as $s) {
    39                 if ($rec = $sections->find('ID',$s->ID)) {
    40                     $sections->replace($rec, $s);
    41                 }
    42             }
    43             return $sections;
    44         }
    45     }
    46 }
    47
    48 class SocleSize_Controller extends Product_Controller {
    49
    50 }
    51
    52 class SocleSize_SocleSectionTextField extends Monument_PolishingTextField {
    53 }
    54

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