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

  • DatalessField
  • HeaderField
  • HiddenField
  • LabelField
  • LiteralField
  • ToggleField
 1 <?php
 2 /**
 3  * Field that generates a heading tag.
 4  * This can be used to add extra text in your forms.
 5  * @package forms
 6  * @subpackage fields-dataless
 7  */
 8 class HeaderField extends DatalessField {
 9     
10     /**
11      * @var int $headingLevel The level of the <h1> to <h6> HTML tag. Default: 2
12      */
13     protected $headingLevel = 2;
14     
15     function __construct($name, $title = null, $headingLevel = 2, $allowHTML = false, $form = null) {
16         // legacy handling for old parameters: $title, $heading, ...
17         // instead of new handling: $name, $title, $heading, ...
18         $args = func_get_args();
19         if(!isset($args[1]) || is_numeric($args[1])) {
20             $title = (isset($args[0])) ? $args[0] : null;
21             // Use "HeaderField(title)" as the default field name for a HeaderField; if it's just set to title then we risk
22             // causing accidental duplicate-field creation.
23             $name = 'HeaderField' . $title; // this means i18nized fields won't be easily accessible through fieldByName()
24             $headingLevel = (isset($args[1])) ? $args[1] : null;
25             $allowHTML = (isset($args[2])) ? $args[2] : null;
26             $form = (isset($args[3])) ? $args[3] : null;
27         } 
28         
29         if($headingLevel) $this->headingLevel = $headingLevel;
30         $this->allowHTML = $allowHTML;
31         
32         parent::__construct($name, $title, null, $allowHTML, $form);
33     }
34     
35     function Field() {
36         $attributes = array(
37             'class' => $this->extraClass(),
38             'id' => $this->id()
39         );
40         return $this->createTag(
41             "h{$this->headingLevel}",
42             $attributes,
43             ($this->getAllowHTML() ? $this->title : Convert::raw2xml($this->title))
44         );
45     }
46 }
47 ?>
[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