'advanced_fields',
'text' => $this->get_form_editor_field_title(),
];
}
/**
* Here we can list all the parameters we want for our field, when you click on it in the editor
* @return array
*/
public function get_form_editor_field_settings()
{
return [
'label_setting',
];
}
/**
* @param $form
* @param string $value
* @param null $entry
*
* This function will generate the html code for the field in the editor and in the front-end
*
* @return string
*/
public function get_field_input($form, $value = '', $entry = null)
{
//We get the hidden lists
$autoSubLists = isset($this->acymAutoSubList) ? implode(',', $this->acymAutoSubList) : '';
$inputHidden = '';
//For the two others parameters: the lists that we displays and the one that are checked
$checkboxes = '';
if (isset($this->acymDisplayedList)) {
$listClass = new ListClass();
$lists = $listClass->getAllForSelect();
if (empty($lists)) return $inputHidden;
$acymCheckedList = isset($this->acymCheckedList) ? $this->acymCheckedList : [];
//We generate the checkboxes
foreach ($this->acymDisplayedList as $listId) {
if (!empty($this->acymAutoSubList) && in_array($listId, $this->acymAutoSubList)) continue;
$checked = in_array($listId, $acymCheckedList) ? 'checked' : '';
$uniqueId = 'gform_acy_list_sub_'.$listId;
//this line allows to know if we are on the editor or the front-end
$isDisabled = $this->is_form_editor() ? 'disabled' : '';
$checkboxes .= '';
$checkboxes .= ' ';
}
}
return ' '.$checkboxes.$inputHidden;
}
/**
* @param $value
* @param $form
* This function is triggered when the form is validated in the front-end, so here we can create and subscribe our user
*
* @return bool
*/
public function validate($value, $form)
{
return true;
}
}
GF_Fields::register(new GF_Field_Acy());