Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • HouseCatalogSearchWidget_Controller
  • Widget
  • Widget_Controller
  • Widget_TreeDropdownField
  • WidgetArea
 1 <?php
 2 /**
 3  * Represents a set of widgets shown on a page.
 4  * @package sapphire
 5  * @subpackage widgets
 6  */
 7 class WidgetArea extends DataObject {
 8     
 9     static $db = array();
10     
11     static $has_one = array();
12     
13     static $has_many = array(
14         "Widgets" => "Widget"
15     );
16     
17     static $many_many = array();
18     
19     static $belongs_many_many = array();
20     
21     public $template = __CLASS__;
22     
23     /**
24      * Used in template instead of {@link Widgets()}
25      * to wrap each widget in its controller, making
26      * it easier to access and process form logic
27      * and actions stored in {@link Widget_Controller}.
28      * 
29      * @return DataObjectSet Collection of {@link Widget_Controller}
30      */
31     function WidgetControllers() {
32         $controllers = new DataObjectSet();
33 
34         foreach($this->ItemsToRender() as $widget) {
35             // find controller
36             $controllerClass = '';
37             foreach(array_reverse(ClassInfo::ancestry($widget->class)) as $widgetClass) {
38                 $controllerClass = "{$widgetClass}_Controller";
39                 if(class_exists($controllerClass)) break;
40             }
41             $controller = new $controllerClass($widget);
42             $controller->init();
43             $controllers->push($controller);
44         }
45 
46         return $controllers;
47     }
48     
49     function Items() {
50         return $this->getComponents('Widgets');
51     }
52     
53     function ItemsToRender() {
54         return $this->getComponents('Widgets', "\"Widget\".\"Enabled\" = 1");
55     }
56     
57     function forTemplate() {
58         return $this->renderWith($this->template); 
59     }
60     
61     function setTemplate($template) {
62         $this->template = $template;
63     }
64     
65     function onBeforeDelete() {
66         parent::onBeforeDelete();
67         foreach($this->Widgets() as $widget) {
68             $widget->delete();
69         }
70     }
71 }
72 
73 ?>
[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. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0