Browse files

Update widget documentation (fixes #706)

  • Loading branch information...
1 parent b211c38 commit f6c69d5241b3556aedad131ceae98c07753e4442 @wilr wilr committed Aug 8, 2012
Showing with 24 additions and 18 deletions.
  1. +24 −18 docs/en/topics/widgets.md
View
42 docs/en/topics/widgets.md
@@ -96,6 +96,7 @@ An example widget is below:
<?php
class FlickrWidget extends Widget {
+
static $db = array(
"User" => "Varchar",
"Photoset" => "Varchar",
@@ -236,28 +237,33 @@ sure that your controller follows the usual naming conventions, and it will be a
:::php
class MyWidget extends Widget {
- static $db = array(
- 'TestValue' => 'Text'
- );
+ static $db = array(
+ 'TestValue' => 'Text'
+ );
}
class MyWidget_Controller extends Widget_Controller {
- function MyFormName() {
- return new Form(
- $this,
- 'MyFormName',
- new FieldSet(
- new TextField('TestValue')
- ),
- new FieldSet(
- new FormAction('doAction')
- )
- );
- }
+
+ function MyFormName() {
+ return new Form(
+ $this,
+ 'MyFormName',
+ new FieldSet(
+ new TextField('TestValue')
+ ),
+ new FieldSet(
+ new FormAction('doAction')
+ )
+ );
+ }
+
+ function doAction($data, $form) {
+ // $this->widget points to the widget
+ }
- function doAction($data, $form) {
- // $this->widget points to the widget
- }
+ function Link() {
+ return __CLASS__;
+ }
}

0 comments on commit f6c69d5

Please sign in to comment.