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

  • DatalessField
  • HeaderField
  • HiddenField
  • LabelField
  • LiteralField
  • ToggleField
 1 <?php
 2 /**
 3  * Simple label tag. This can be used to add extra text in your forms.
 4  * Consider using a {@link ReadonlyField} if you need to display a label
 5  * AND a value.
 6  * 
 7  * @package forms
 8  * @subpackage fields-dataless
 9  */
10 class LabelField extends DatalessField {
11     
12     /**
13      * @param string $name
14      * @param string $title
15      * @param string $className (Deprecated: use addExtraClass())
16      * @param bool $allowHTML (Deprecated: use setAllowHTML())
17      * @param Form $form
18      */
19     function __construct($name, $title, $className = null, $allowHTML = false, $form = null) {
20         // legacy handling for old parameters: $title, $heading, ...
21         // instead of new handling: $name, $title, $heading, ...
22         $args = func_get_args();
23         if(!isset($args[1])) {
24             $title = (isset($args[0])) ? $args[0] : null;
25             $name = $title;
26             $classname = (isset($args[1])) ? $args[1] : null;
27             $allowHTML = (isset($args[2])) ? $args[2] : null;
28             $form = (isset($args[3])) ? $args[3] : null;
29         } 
30         
31         parent::__construct($name, $title, null, $allowHTML, $form);
32     }
33     
34     /**
35      * Returns a label containing the title, and an HTML class if given.
36      */
37     function Field() {
38         $attributes = array(
39             'class' => $this->extraClass(),
40             'id' => $this->id()
41         );
42         return $this->createTag(
43             'label',
44             $attributes,
45             ($this->getAllowHTML() ? $this->title : htmlspecialchars($this->title))
46         );
47     }
48 }
49 ?>
[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