silverstripe-framework/Forms/LabelField.php
Damian Mooyman 8dd644d25d
API Namespace all classes
Namespace all templates
Move difflib and BBCodeParser2 to thirdparty
Remove deprecated API marked for removal in 4.0
2016-09-08 10:23:17 +12:00

35 lines
683 B
PHP

<?php
namespace SilverStripe\Forms;
/**
* Simple label, to add extra text in your forms.
*
* Use a {@link ReadonlyField} if you need to display a label and value.
*/
class LabelField extends DatalessField {
/**
* @param string $name
* @param null|string $title
*/
public function __construct($name, $title = null) {
// legacy handling:
// $title, $headingLevel...
$args = func_get_args();
if(!isset($args[1])) {
$title = (isset($args[0])) ? $args[0] : null;
if(isset($args[0])) {
$title = $args[0];
}
// Prefix name to avoid collisions.
/** @skipUpgrade */
$name = 'LabelField' . $title;
}
parent::__construct($name, $title);
}
}