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

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • 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  * Action that uses an image instead of a button
 4  * @package forms
 5  * @subpackage actions
 6  */
 7 class ImageFormAction extends FormAction {
 8     protected $image, $hoverImage, $className;
 9     
10     /**
11      * Create a new action button.
12      * @param action The method to call when the button is clicked
13      * @param title The label on the button
14      * @param image The default image to display
15      * @param hoverImage The image to display on hover
16      * @param form The parent form, auto-set when the field is placed inside a form 
17      */
18     function __construct($action, $title = "", $image = "", $hoverImage = null, $className = null, $form = null) {
19         $this->image = $image;
20         $this->hoverImage = $hoverImage;
21         $this->className = $className;
22         parent::__construct($action, $title, $form);
23     }
24     function Field() {
25         Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
26         Requirements::javascript(SAPPHIRE_DIR . '/javascript/ImageFormAction.js');
27         
28         $classClause = '';
29         if($this->className) $classClause = $this->className . ' ';
30         if($this->hoverImage) $classClause .= 'rollover ';
31         return "<input class=\"{$classClause}action\" id=\"" . $this->id() . "\" type=\"image\" name=\"{$this->name}\" src=\"{$this->image}\" title=\"{$this->title}\" alt=\"{$this->title}\" />";
32     }
33 }
34 
35 ?>
[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.1 API Docs API documentation generated by ApiGen 2.8.0