Skip to content
Create a gist now

Instantly share code, notes, and snippets.

EditableHiddenField for UserDefinedForms
* @package userforms
class EditableHiddenField extends EditableFormField {
private static $singular_name = 'Hidden Field';
private static $plural_name = 'Hidden Fields';
public function getFieldConfiguration() {
$options = parent::getFieldConfiguration();
new TextField($this->getSettingName("Variable"), 'Value (use GET["a"]) to accept GET parameters', $this->getSetting('Variable')),
new CheckboxField(
_t('EditableLiteralField.HIDEFROMREPORT', 'Hide from reports?'),
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.