Пример #1
0
 /**
  * Adds the fields for the Widgets tab
  *
  * @param FieldList $fields FieldList to add fields to
  * 
  * @return void
  */
 public function getFieldsForWidgets($fields)
 {
     $widgetAreaFields = WidgetSet::scaffold_widget_area_fields_for($this);
     $fields->addFieldsToTab('Root.Widgets', $widgetAreaFields);
 }
Пример #2
0
 /**
  * Returns the related WidgetSet.
  * 
  * @return SilvercartWidgetSet
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 11.10.2013
  */
 public function WidgetSet()
 {
     $widgetSet = WidgetSet::get()->filter('WidgetAreaID', $this->ParentID);
     return $widgetSet;
 }
 /**
  * Creates all pages and widgets for the slidorion widgets.
  *
  * @param WidgetSet $widgetSetFrontPageContentArea The widgetset content area
  * 
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 16.06.2014
  */
 public static function createTestDataSlidorion($widgetSetFrontPageContentArea)
 {
     $silvercartFrontPage = SilvercartFrontPage::get()->first();
     /*
     $productGroupHolderRoot = SilvercartTools::PageByIdentifierCode('SilvercartProductGroupHolder');
     
     //create product group holder page
     $productGroupHolder = new SilvercartProductGroupHolder();
     $productGroupHolder->Title = _t('SilvercartTestData.slidorion_productGroupHolder_TITLE');
     $productGroupHolder->URLSegment = _t('SilvercartTestData.slidorion_productGroupHolder_URLSEGMENT');
     $productGroupHolder->Status = "Published";
     $productGroupHolder->IdentifierCode = 'SilvercartAboutSilvercartSlidorion';
     $productGroupHolder->ParentID = $productGroupHolderRoot->ID;
     $productGroupHolder->ShowInMenus = false;
     $productGroupHolder->ShowInSearch = false;
     $productGroupHolder->write();
     $productGroupHolder->publish("Stage", "Live");
     
     $productGroupCustomisable = new SilvercartProductGroupPage();
     $productGroupCustomisable->Title = _t('SilvercartTestData.PRODUCTGROUPCUSTOMISABLE_TITLE');
     $productGroupCustomisable->URLSegment = _t('SilvercartTestData.PRODUCTGROUPCUSTOMISABLE_URLSEGMENT');
     $productGroupCustomisable->Content = _t('SilvercartTestData.PRODUCTGROUPCUSTOMISABLE_CONTENT');
     $productGroupCustomisable->Status = "Published";
     $productGroupCustomisable->IdentifierCode = 'SilvercartProductGroupCustomisable';
     $productGroupCustomisable->ParentID = $productGroupHolder->ID;
     $productGroupCustomisable->ShowInMenus = true;
     $productGroupCustomisable->ShowInSearch = true;
     $productGroupCustomisable->write();
     $productGroupCustomisable->publish("Stage", "Live");
     
     $productGroupExtendable = new SilvercartProductGroupPage();
     $productGroupExtendable->Title = _t('SilvercartTestData.PRODUCTGROUPEXTENDABLE_TITLE');
     $productGroupExtendable->URLSegment = _t('SilvercartTestData.PRODUCTGROUPEXTENDABLE_URLSEGMENT');
     $productGroupExtendable->Content = _t('SilvercartTestData.PRODUCTGROUPEXTENDABLE_CONTENT');
     $productGroupExtendable->Status = "Published";
     $productGroupExtendable->IdentifierCode = 'SilvercartproductGroupExtendable';
     $productGroupExtendable->ParentID = $productGroupHolder->ID;
     $productGroupExtendable->ShowInMenus = true;
     $productGroupExtendable->ShowInSearch = true;
     $productGroupExtendable->write();
     $productGroupExtendable->publish("Stage", "Live");
     
     $productGroupOpen = new SilvercartProductGroupPage();
     $productGroupOpen->Title = _t('SilvercartTestData.PRODUCTGROUPOPEN_TITLE');
     $productGroupOpen->URLSegment = _t('SilvercartTestData.PRODUCTGROUPOPEN_URLSEGMENT');
     $productGroupOpen->Content = _t('SilvercartTestData.PRODUCTGROUPOPEN_CONTENT');
     $productGroupOpen->Status = "Published";
     $productGroupOpen->IdentifierCode = 'SilvercartProductGroupOpen';
     $productGroupOpen->ParentID = $productGroupHolder->ID;
     $productGroupOpen->ShowInMenus = true;
     $productGroupOpen->ShowInSearch = true;
     $productGroupOpen->write();
     $productGroupOpen->publish("Stage", "Live");
     */
     // Create Widget
     $widgetSlidorion = new SilvercartSlidorionProductGroupWidget();
     $widgetSlidorion->setField('Sort', 1);
     $widgetSlidorion->setField('Title', _t('SilvercartTestData.SLIDORION_TITLE'));
     $widgetSlidorion->write();
     /*
     $widgetSlidorion->SCProductGroupPages()->add($productGroupCustomisable);
     $widgetSlidorion->SCProductGroupPages()->add($productGroupExtendable);
     $widgetSlidorion->SCProductGroupPages()->add($productGroupOpen);
     */
     $widgetSetFrontPageContentArea->Widgets()->add($widgetSlidorion);
 }