Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
EditableHiddenField for UserDefinedForms
<?php
/**
* @package userforms
*/
class EditableHiddenField extends EditableFormField {
private static $singular_name = 'Hidden Field';
private static $plural_name = 'Hidden Fields';
public function getFieldConfiguration() {
$options = parent::getFieldConfiguration();
$options->push(
new TextField($this->getSettingName("Variable"), 'Value (use GET["a"]) to accept GET parameters', $this->getSetting('Variable')),
new CheckboxField(
$this->getSettingName('HideFromReports'),
_t('EditableLiteralField.HIDEFROMREPORT', 'Hide from reports?'),
$this->getSetting('HideFromReports')
)
);
if($this->readonly) {
$extraFields = $options->makeReadonly();
}
return $options;
}
public function getFormField() {
$var = $this->getSetting('Variable');
if(preg_match("/^GET\[(.*)\]$/i", $var, $results)) {
$var = (isset($_GET[$results[1]])) ? $_GET[$results[1]] : "";
}
return new HiddenField($this->Name, $this->Title, $var);
}
public function showInReports() {
return (!$this->getSetting('HideFromReports'));
}
public function getFieldValidationOptions() {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.