2009-03-25 04:37:49 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2009-04-17 04:26:40 +02:00
|
|
|
* Editable Literal Field. A literal field is just a blank slate where
|
|
|
|
* you can add your own HTML / Images / Flash
|
2009-03-25 04:37:49 +01:00
|
|
|
*
|
2009-04-17 04:26:40 +02:00
|
|
|
* @package userforms
|
2009-03-25 04:37:49 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
class EditableLiteralField extends EditableFormField {
|
|
|
|
|
2009-03-25 06:25:50 +01:00
|
|
|
static $singular_name = 'HTML Block';
|
2009-03-25 04:37:49 +01:00
|
|
|
|
2009-04-17 04:26:40 +02:00
|
|
|
static $plural_name = 'HTML Blocks';
|
2009-03-25 04:37:49 +01:00
|
|
|
|
2012-05-04 03:39:08 +02:00
|
|
|
public function getFieldConfiguration() {
|
2012-07-17 05:58:24 +02:00
|
|
|
$customSettings = unserialize($this->CustomSettings);
|
|
|
|
$content = (isset($customSettings['Content'])) ? $customSettings['Content'] : '';
|
2012-05-07 07:07:32 +02:00
|
|
|
$textAreaField = new TextareaField(
|
|
|
|
$this->getSettingName('Content'),
|
2012-07-17 05:58:24 +02:00
|
|
|
"HTML",
|
|
|
|
$content
|
2012-05-07 07:07:32 +02:00
|
|
|
);
|
|
|
|
$textAreaField->setRows(4);
|
|
|
|
$textAreaField->setColumns(20);
|
|
|
|
|
2012-04-22 21:17:42 +02:00
|
|
|
return new FieldList(
|
2012-05-07 07:07:32 +02:00
|
|
|
$textAreaField,
|
2011-12-05 09:38:10 +01:00
|
|
|
new CheckboxField(
|
2012-04-14 08:36:50 +02:00
|
|
|
$this->getSettingName('HideFromReports'),
|
2011-12-05 09:38:10 +01:00
|
|
|
_t('EditableLiteralField.HIDEFROMREPORT', 'Hide from reports?'),
|
|
|
|
$this->getSetting('HideFromReports')
|
|
|
|
)
|
2009-05-06 05:34:40 +02:00
|
|
|
);
|
2009-03-25 04:37:49 +01:00
|
|
|
}
|
2009-04-27 06:01:06 +02:00
|
|
|
|
2012-05-04 03:39:08 +02:00
|
|
|
public function getFormField() {
|
2009-03-25 04:37:49 +01:00
|
|
|
return new LiteralField("LiteralField[$this->ID]",
|
2011-12-05 09:38:10 +01:00
|
|
|
"<div id='$this->Name' class='field text'>
|
|
|
|
<label class='left'>$this->Title</label>
|
|
|
|
<div class='middleColumn literalFieldArea'>". $this->getSetting('Content') ."</div>".
|
|
|
|
"</div>"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-05-04 03:39:08 +02:00
|
|
|
public function showInReports() {
|
2012-04-14 08:36:50 +02:00
|
|
|
return (!$this->getSetting('HideFromReports'));
|
2009-03-25 04:37:49 +01:00
|
|
|
}
|
2012-07-17 05:58:24 +02:00
|
|
|
}
|