2008-09-29 05:18:23 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Allows an editor to insert a generic heading into a field
|
2009-04-17 04:26:40 +02:00
|
|
|
*
|
|
|
|
* @subpackage userforms
|
2008-09-29 05:18:23 +02:00
|
|
|
*/
|
2009-12-07 03:04:20 +01:00
|
|
|
|
2008-09-29 05:18:23 +02:00
|
|
|
class EditableFormHeading extends EditableFormField {
|
2009-04-27 06:01:06 +02:00
|
|
|
|
2009-05-06 05:34:40 +02:00
|
|
|
static $singular_name = 'Heading';
|
2009-04-17 04:26:40 +02:00
|
|
|
|
2009-05-06 05:34:40 +02:00
|
|
|
static $plural_name = 'Headings';
|
2008-09-29 05:18:23 +02:00
|
|
|
|
2009-05-06 05:34:40 +02:00
|
|
|
function getFieldConfiguration() {
|
2009-04-27 06:01:06 +02:00
|
|
|
$levels = array('1' => '1','2' => '2','3' => '3','4' => '4','5' => '5','6' => '6');
|
|
|
|
$level = ($this->getSetting('Level')) ? $this->getSetting('Level') : 3;
|
2009-05-06 05:34:40 +02:00
|
|
|
|
|
|
|
$options = parent::getFieldConfiguration();
|
|
|
|
$options->push(new DropdownField("Fields[$this->ID][CustomSettings][Level]", _t('EditableFormHeading.LEVEL', 'Select Heading Level'), $levels, $level));
|
2009-04-21 05:44:13 +02:00
|
|
|
|
|
|
|
if($this->readonly) {
|
2009-05-06 05:34:40 +02:00
|
|
|
$extraFields = $options->makeReadonly();
|
2009-04-21 05:44:13 +02:00
|
|
|
}
|
2009-05-06 05:34:40 +02:00
|
|
|
return $options;
|
2009-04-21 05:44:13 +02:00
|
|
|
}
|
|
|
|
|
2008-09-29 05:18:23 +02:00
|
|
|
function getFormField() {
|
2009-05-08 06:27:49 +02:00
|
|
|
$labelField = new HeaderField($this->Name,$this->Title, $this->getSetting('Level'));
|
2008-11-01 16:32:36 +01:00
|
|
|
$labelField->addExtraClass('FormHeading');
|
2009-04-21 05:44:13 +02:00
|
|
|
|
2008-11-01 16:32:36 +01:00
|
|
|
return $labelField;
|
2008-09-29 05:18:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function showInReports() {
|
|
|
|
return false;
|
|
|
|
}
|
2009-05-06 05:34:40 +02:00
|
|
|
|
|
|
|
function getFieldValidationOptions() {
|
|
|
|
return false;
|
|
|
|
}
|
2009-12-07 03:04:20 +01:00
|
|
|
}
|