'etiquettes', 'hide_empty' => false, // Include empty terms )); // Find the checkbox field by ID foreach ($form['fields'] as &$field) { if ($field->id == $field_id) { // Prepare choices and inputs array for checkboxes $choices = array(); $inputs = array(); $index = 1; foreach ($terms as $term) { $choices[] = array( 'text' => $term->name, 'value' => $term->name, // Use term name as value for display 'isSelected' => false, ); // For checkboxes, each choice needs a corresponding input $inputs[] = array( 'id' => $field->id . '.' . $index, 'label' => $term->name, 'name' => '', ); $index++; } // Update choices and inputs for the checkbox field $field->choices = $choices; $field->inputs = $inputs; // Ensure the field is not marked as administrative only $field->adminOnly = false; break; } } } return $form; }