protected function WebformContentCreatorManageFieldsForm::constructCustomCheck in Webform Content Creator 3.x
1 call to WebformContentCreatorManageFieldsForm::constructCustomCheck()
- WebformContentCreatorManageFieldsForm::constructTable in src/
Form/ WebformContentCreatorManageFieldsForm.php - Constructs table with mapping between webform and content type.
File
- src/
Form/ WebformContentCreatorManageFieldsForm.php, line 211
Class
- WebformContentCreatorManageFieldsForm
- Form handler for the Webform content creator manage fields form.
Namespace
Drupal\webform_content_creator\FormCode
protected function constructCustomCheck($field_id, array $attributes, $component_field = NULL) {
// Checkbox to select between webform element/property or custom text.
if (!empty($component_field)) {
$default_value = array_key_exists($field_id, $attributes) && isset($attributes[$field_id][$component_field][self::CUSTOM_CHECK]) ? $attributes[$field_id][$component_field][self::CUSTOM_CHECK] : '';
}
else {
$default_value = array_key_exists($field_id, $attributes) && isset($attributes[$field_id][self::CUSTOM_CHECK]) ? $attributes[$field_id][self::CUSTOM_CHECK] : '';
}
$custom_checkbox = [
'#type' => 'checkbox',
'#title' => !empty($component_field) ? '(' . $component_field . ')' : NULL,
'#default_value' => $default_value,
'#states' => [
'disabled' => [
':input[name="' . self::FORM_TABLE . '[' . $field_id . '][' . self::CONTENT_TYPE_FIELD . ']"]' => [
'checked' => FALSE,
],
],
],
];
return $custom_checkbox;
}