/** * Initialize Job and Company Fields * * Called by WP Job Manager filter in init_fields() to return job and * company fields with user customization. * * Will return ALL fields including disabled fields * * @since 1.1.9 * * @param array $fields * * @return mixed */ function init_fields($fields) { if (!$this->was_filter_forced()) { $fields = $this->merge_with_custom_fields($fields); // Remove resume fields after merge if (isset($fields['resume_fields'])) { unset($fields['resume_fields']); } $product_id = isset($_REQUEST['wcpl_jmfe_product_id']) ? intval($_REQUEST['wcpl_jmfe_product_id']) : ''; $job_package = isset($_REQUEST['job_package']) ? sanitize_text_field($_REQUEST['job_package']) : $product_id; $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : false; $job_id = isset($_REQUEST['job_id']) ? intval($_REQUEST['job_id']) : false; // Admin only filter $fields = $this->admin_only_fields($fields); // Product/Package Handling, get job_package from post meta if ($job_id && empty($job_package)) { $job_package = WP_Job_Manager_Field_Editor_Package_WC::get_post_package_id($job_id); } // If listing is tied to package, filter so only fields for that package are shown if ($job_package) { $fields = WP_Job_Manager_Field_Editor_Package_WC::filter_fields($fields, $job_package); } // If fields not init by preview, or save, return standard fields ( customizations returned in new_job_fields ) if ($this->validate_errors || !empty($job_package) || !$job_id || isset($_POST['submit_job']) && !empty($_POST['submit_job'])) { $fields = $this->new_job_fields($fields); } // If called by force validation, set fields equal to field config for validation if ($this->force_validate) { $fields = $this->validation_fields($fields); } } return $fields; }
/** * Initialize Resume Fields * * Called by WP Job Manager filter in init_fields() to return * resume fields with user customization. * * @since 1.1.9 * * @param array $fields * * @return mixed */ function init_fields($fields) { if (!$this->was_filter_forced()) { $fields = $this->merge_with_custom_fields($fields); // Remove job fields after merge if (isset($fields['job'])) { unset($fields['job']); } // Remove company fields after merge if (isset($fields['company'])) { unset($fields['company']); } $product_id = isset($_REQUEST['wcpl_jmfe_product_id']) ? intval($_REQUEST['wcpl_jmfe_product_id']) : ''; $resume_package = isset($_REQUEST['resume_package']) ? sanitize_text_field($_REQUEST['resume_package']) : $product_id; $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : FALSE; $resume_id = isset($_REQUEST['resume_id']) ? intval($_REQUEST['resume_id']) : FALSE; // Admin only filter $fields = $this->admin_only_fields($fields); // Product/Package Handling, get job_package from post meta if ($resume_id && empty($resume_package)) { $resume_package = WP_Job_Manager_Field_Editor_Package_WC::get_post_package_id($resume_id); } // If listing is tied to package, filter so only fields for that package are shown if ($resume_package) { $fields = WP_Job_Manager_Field_Editor_Package_WC::filter_fields($fields, $resume_package); } // If fields init by post new resume, return fields with disabled removed if ($this->validate_errors || !empty($resume_package) || !$resume_id || isset($_POST['submit_resume']) && !empty($_POST['submit_resume'])) { $fields = $this->new_resume_fields($fields); } // If called by force validation, set fields equal to field config for validation if ($this->force_validate) { $fields = $this->validation_fields($fields); } } return $fields; }