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

  • DisabledTransformation
  • FormTransformation
  • PrintableTransformation
  • PrintableTransformation_TabSet
  • ReadonlyTransformation
  • TabularStyle
 1 <?php
 2 /**
 3  * This is a form decorator (a class that wraps around a form) providing us with some functions
 4  * to display it in a Tabular style.
 5  * @package forms
 6  * @subpackage transformations
 7  */
 8 class TabularStyle extends ViewableData {
 9     protected $form;
10 
11     /**
12      * Represent the given form in a tabular style
13      * @param form The form to decorate.
14      */
15     function __construct($form) {
16         $this->form = $form;
17         $this->failover = $form;
18         parent::__construct();
19     }
20     
21     /**
22      * Return a representation of this form as a table row
23      */
24     function AsTableRow() {
25         return "<tr class=\"addrow\">{$this->CellFields()}<td class=\"actions\">{$this->CellActions()}</td></tr>";
26     }
27     
28     function CellFields() {
29         $result = "";
30         $hiddenFields = '';
31         foreach($this->form->Fields() as $field) {
32             if(!$field->is_a('HiddenField')) {
33                 $result .= "<td>" . $field->Field() . "</td>";
34             } else {
35                 $hiddenFields .= $field->Field();
36             }
37         }
38         
39         // Add hidden fields in the last cell
40         $result = substr($result,0,-5) . $hiddenFields . substr($result,-5);
41         
42         return $result;
43     }
44 
45     function CellActions() {
46         $actions = "";
47         foreach($this->form->Actions() as $action) {
48             $actions .= $action->Field();
49         }
50         return $actions;
51     }
52     
53     
54 
55     /**
56      * This is the 'wrapper' aspect of the code
57      */
58     function __call($func, $args) {
59         return call_user_func_array(array(&$this->form, $func), $args);
60     }
61     function __get($field) {
62         return $this->form->$field;
63     }
64     function __set($field, $val) {
65         $this->form->$field = $val;
66     }
67 }
68 ?>
[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