mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
8dd644d25d
Namespace all templates Move difflib and BBCodeParser2 to thirdparty Remove deprecated API marked for removal in 4.0
35 lines
683 B
PHP
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);
|
|
}
|
|
}
|