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

  • FormAction
  • FormAction_WithoutLabel
  • ImageFormAction
  • InlineFormAction
  • InlineFormAction_ReadOnly
  • ResetFormAction
 1 <?php
 2 /**
 3  * Render a button that will submit the form its contained in through ajax.
 4  * If you want to add custom behaviour, please set {@link inlcudeDefaultJS()} to FALSE and work with behaviour.js.
 5  * 
 6  * @see sapphire/javascript/InlineFormAction.js
 7  * 
 8  * @package forms
 9  * @subpackage actions
10  */
11 class InlineFormAction extends FormField {
12     
13     protected $includeDefaultJS = true;
14 
15     /**
16      * Create a new action button.
17      * @param action The method to call when the button is clicked
18      * @param title The label on the button
19      * @param extraClass A CSS class to apply to the button in addition to 'action'
20      */
21     function __construct($action, $title = "", $extraClass = '') {
22         $this->extraClass = ' '.$extraClass;
23         parent::__construct($action, $title, null, null);
24     }
25     
26     function performReadonlyTransformation() {
27         return new InlineFormAction_ReadOnly( $this->name, $this->title );
28     }
29     
30     function Field() {
31         if($this->includeDefaultJS) {
32             Requirements::javascriptTemplate(SAPPHIRE_DIR . '/javascript/InlineFormAction.js',array('ID'=>$this->id()));
33         }
34         
35         return "<input type=\"submit\" name=\"action_{$this->name}\" value=\"{$this->title}\" id=\"{$this->id()}\" class=\"action{$this->extraClass}\" />";
36     }   
37     
38     function Title() { 
39         return false; 
40     }
41     
42     /**
43      * Optionally disable the default javascript include (sapphire/javascript/InlineFormAction.js),
44      * which routes to an "admin-custom"-URL.
45      * 
46      * @param $bool boolean
47      */
48     function includeDefaultJS($bool) {
49         $this->includeDefaultJS = (bool)$bool;
50     }
51 }
52 
53 /**
54  * Readonly version of {@link InlineFormAction}.
55  * @package forms
56  * @subpackage actions
57  */
58 class InlineFormAction_ReadOnly extends FormField {
59     
60     protected $readonly = true;
61     
62     function Field() {
63         return "<input type=\"submit\" name=\"action_{$this->name}\" value=\"{$this->title}\" id=\"{$this->id()}\" disabled=\"disabled\" class=\"action disabled$this->extraClass\" />";
64     }   
65     
66     function Title() { 
67         return false; 
68     }
69 }
70 ?>
[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