mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-06-16 01:21:37 +02:00
3.1 compatibility
This commit is contained in:
parent
0177699620
commit
8bcddb55ce
|
@ -5,9 +5,7 @@ php:
|
||||||
- 5.3
|
- 5.3
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- DB=MYSQL CORE_RELEASE=3.0
|
|
||||||
- DB=MYSQL CORE_RELEASE=3.1
|
- DB=MYSQL CORE_RELEASE=3.1
|
||||||
- DB=MYSQL CORE_RELEASE=master
|
|
||||||
- DB=PGSQL CORE_RELEASE=master
|
- DB=PGSQL CORE_RELEASE=master
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
|
18
README.md
18
README.md
|
@ -11,7 +11,7 @@ the sidebar of your website. To check out a what a [Widget](http://silverstripe.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
* SilverStripe 3.0
|
* SilverStripe 3.1
|
||||||
|
|
||||||
## How to Use A Widget
|
## How to Use A Widget
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ e.g.
|
||||||
|
|
||||||
class Page extends SiteTree {
|
class Page extends SiteTree {
|
||||||
...
|
...
|
||||||
static $has_one = array(
|
private static $has_one = array(
|
||||||
"MyWidgetArea" => "WidgetArea",
|
"MyWidgetArea" => "WidgetArea",
|
||||||
);
|
);
|
||||||
|
|
||||||
public function getCMSFields() {
|
public function getCMSFields() {
|
||||||
|
@ -105,7 +105,7 @@ An example widget is below:
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class FlickrWidget extends Widget {
|
class FlickrWidget extends Widget {
|
||||||
static $db = array(
|
private static $db = array(
|
||||||
"User" => "Varchar",
|
"User" => "Varchar",
|
||||||
"Photoset" => "Varchar",
|
"Photoset" => "Varchar",
|
||||||
"Tags" => "Varchar",
|
"Tags" => "Varchar",
|
||||||
|
@ -113,14 +113,14 @@ An example widget is below:
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
static $defaults = array(
|
private static $defaults = array(
|
||||||
"NumberToShow" => 8
|
"NumberToShow" => 8
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
static $title = "Photos";
|
private static $title = "Photos";
|
||||||
static $cmsTitle = "Flickr Photos";
|
private static $cmsTitle = "Flickr Photos";
|
||||||
static $description = "Shows flickr photos.";
|
private static $description = "Shows flickr photos.";
|
||||||
|
|
||||||
public function Photos() {
|
public function Photos() {
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/prototype/prototype.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/prototype/prototype.js");
|
||||||
|
@ -236,7 +236,7 @@ sure that your controller follows the usual naming conventions, and it will be a
|
||||||
**mysite/code/MyWidget.php**
|
**mysite/code/MyWidget.php**
|
||||||
|
|
||||||
class MyWidget extends Widget {
|
class MyWidget extends Widget {
|
||||||
static $db = array(
|
private static $db = array(
|
||||||
'TestValue' => 'Text'
|
'TestValue' => 'Text'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ class WidgetContentControllerExtension extends Extension {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
'handleWidget'
|
'handleWidget'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Widget extends DataObject {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $db = array(
|
private static $db = array(
|
||||||
"Sort" => "Int",
|
"Sort" => "Int",
|
||||||
"Enabled" => "Boolean"
|
"Enabled" => "Boolean"
|
||||||
);
|
);
|
||||||
|
@ -25,7 +25,7 @@ class Widget extends DataObject {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $defaults = array(
|
private static $defaults = array(
|
||||||
'Enabled' => true
|
'Enabled' => true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class Widget extends DataObject {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $has_one = array(
|
private static $has_one = array(
|
||||||
"Parent" => "WidgetArea",
|
"Parent" => "WidgetArea",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -41,43 +41,43 @@ class Widget extends DataObject {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $has_many = array();
|
private static $has_many = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $many_many = array();
|
private static $many_many = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $belongs_many_many = array();
|
private static $belongs_many_many = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $default_sort = "\"Sort\"";
|
private static $default_sort = "\"Sort\"";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $title = "Widget Title";
|
private static $title = "Widget Title";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $cmsTitle = "Name of this widget";
|
private static $cmsTitle = "Name of this widget";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $description = "Description of what this widget does.";
|
private static $description = "Description of what this widget does.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -245,7 +245,7 @@ class Widget_Controller extends Controller {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
'editablesegment'
|
'editablesegment'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -10,34 +10,10 @@ class WidgetArea extends DataObject {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $db = array();
|
private static $has_many = array(
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $has_one = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $has_many = array(
|
|
||||||
"Widgets" => "Widget"
|
"Widgets" => "Widget"
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $many_many = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $belongs_many_many = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
],
|
],
|
||||||
"require":
|
"require":
|
||||||
{
|
{
|
||||||
"silverstripe/framework": "3.*",
|
"silverstripe/framework": "~3.1",
|
||||||
"silverstripe/cms": "3.*"
|
"silverstripe/cms": "~3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -447,17 +447,17 @@ class WidgetAreaEditorTest extends SapphireTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
class WidgetAreaEditorTest_FakePage extends Page implements TestOnly {
|
class WidgetAreaEditorTest_FakePage extends Page implements TestOnly {
|
||||||
public static $has_one = array(
|
private static $has_one = array(
|
||||||
"SideBar" => "WidgetArea",
|
"SideBar" => "WidgetArea",
|
||||||
"BottomBar" => "WidgetArea",
|
"BottomBar" => "WidgetArea",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class WidgetAreaEditorTest_TestWidget extends Widget implements TestOnly {
|
class WidgetAreaEditorTest_TestWidget extends Widget implements TestOnly {
|
||||||
static $cmsTitle = "Test widget";
|
private static $cmsTitle = "Test widget";
|
||||||
static $title = "Test widget";
|
private static $title = "Test widget";
|
||||||
static $description = "Test widget";
|
private static $description = "Test widget";
|
||||||
static $db = array(
|
private static $db = array(
|
||||||
'Title' => 'Varchar'
|
'Title' => 'Varchar'
|
||||||
);
|
);
|
||||||
public function getCMSFields() {
|
public function getCMSFields() {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
*/
|
*/
|
||||||
class WidgetControllerTest extends FunctionalTest {
|
class WidgetControllerTest extends FunctionalTest {
|
||||||
static $fixture_file = 'WidgetControllerTest.yml';
|
protected static $fixture_file = 'WidgetControllerTest.yml';
|
||||||
|
|
||||||
protected $extraDataObjects = array(
|
protected $extraDataObjects = array(
|
||||||
'WidgetControllerTestPage',
|
'WidgetControllerTestPage',
|
||||||
|
@ -54,7 +54,7 @@ class WidgetControllerTest extends FunctionalTest {
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
*/
|
*/
|
||||||
class WidgetControllerTest_Widget extends Widget implements TestOnly {
|
class WidgetControllerTest_Widget extends Widget implements TestOnly {
|
||||||
static $db = array(
|
private static $db = array(
|
||||||
'TestValue' => 'Text'
|
'TestValue' => 'Text'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
*/
|
*/
|
||||||
class WidgetControllerTestPage extends Page implements TestOnly {
|
class WidgetControllerTestPage extends Page implements TestOnly {
|
||||||
static $has_one = array(
|
private static $has_one = array(
|
||||||
'WidgetControllerTestSidebar' => 'WidgetArea'
|
'WidgetControllerTestSidebar' => 'WidgetArea'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user