/** * Return fields for Submissions App * Exclude file and button fields * * @return array */ public function getFieldsForSubmissions() { // All fields except buttons $fields = $this->getFields(); // Exclude file fields $fields = ArrayHelper::exclude($fields, ['file'], 'type'); // Exclude disabled fields // $enabledFields = ArrayHelper::exclude($fields, true, 'disabled'); $options = array(); foreach ($fields as $field) { // For Checkboxes and Radio Buttons // We take the name and label of the group if (isset($field['type']) && ($field['type'] === "checkbox" || $field['type'] === "radio")) { // Check if the field was saved in options before if (isset($field['name']) && isset($options[$field['name']])) { continue; } // Set option attributes $option = ['name' => $field['name'], 'label' => $this->getFieldLabel($field, true)]; // Save the option, by the name of the field $options[$option['name']] = $option; continue; // Skip the rest of the current loop iteration } // Default $option = ['name' => $field['id'], 'label' => $this->getFieldLabel($field)]; $options[$option['name']] = $option; } return array_values($options); // Remove keys }