The job_type select field had empty options because Formidable stores them in a top-level `options` key, not nested inside `field_options`. The job_logo field is removed from both submission and edit forms since the logo is managed per-provider on the dashboard. Includes a one-time repair migration that fixes existing fields in the database (updates job_type options, deletes job_logo fields). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
105 lines
2.6 KiB
PHP
105 lines
2.6 KiB
PHP
<?php
|
|
/**
|
|
* ACF field groups handler
|
|
*
|
|
* @package DDHH_Job_Manager
|
|
*/
|
|
|
|
// Exit if accessed directly.
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
/**
|
|
* Handles ACF field group registration
|
|
*/
|
|
class DDHH_JM_ACF_Fields {
|
|
|
|
/**
|
|
* Register ACF field groups
|
|
* Hooked to 'acf/init'
|
|
*/
|
|
public static function register_fields() {
|
|
// Check if ACF Pro is available
|
|
if ( ! function_exists( 'acf_add_local_field_group' ) ) {
|
|
return;
|
|
}
|
|
|
|
// Register Job Details field group
|
|
acf_add_local_field_group(
|
|
array(
|
|
'key' => 'group_job_details',
|
|
'title' => __( 'Job Details', 'ddhh-job-manager' ),
|
|
'fields' => array(
|
|
// Job Location
|
|
array(
|
|
'key' => 'field_job_location',
|
|
'label' => __( 'Standort', 'ddhh-job-manager' ),
|
|
'name' => 'job_location',
|
|
'type' => 'text',
|
|
'required' => 1,
|
|
),
|
|
// Job Type
|
|
array(
|
|
'key' => 'field_job_type',
|
|
'label' => __( 'Art', 'ddhh-job-manager' ),
|
|
'name' => 'job_type',
|
|
'type' => 'select',
|
|
'required' => 1,
|
|
'choices' => array(
|
|
'vollzeit' => __( 'Vollzeit', 'ddhh-job-manager' ),
|
|
'teilzeit' => __( 'Teilzeit', 'ddhh-job-manager' ),
|
|
'ehrenamt' => __( 'Ehrenamt', 'ddhh-job-manager' ),
|
|
),
|
|
),
|
|
// Job Deadline
|
|
array(
|
|
'key' => 'field_job_deadline',
|
|
'label' => __( 'Bewerbungsfrist', 'ddhh-job-manager' ),
|
|
'name' => 'job_deadline',
|
|
'type' => 'date_picker',
|
|
'required' => 0,
|
|
'return_format' => 'Y-m-d',
|
|
'display_format' => 'd.m.Y',
|
|
),
|
|
// Job Contact Email
|
|
array(
|
|
'key' => 'field_job_contact_email',
|
|
'label' => __( 'Kontakt-E-Mail', 'ddhh-job-manager' ),
|
|
'name' => 'job_contact_email',
|
|
'type' => 'email',
|
|
'required' => 1,
|
|
),
|
|
// Job Deactivation Reason (internal, admin-only)
|
|
array(
|
|
'key' => 'field_job_deactivation_reason',
|
|
'label' => __( 'Deaktivierungsgrund (intern)', 'ddhh-job-manager' ),
|
|
'name' => 'job_deactivation_reason',
|
|
'type' => 'textarea',
|
|
'required' => 0,
|
|
'rows' => 3,
|
|
'conditional_logic' => array(
|
|
array(
|
|
array(
|
|
'field' => 'post_status',
|
|
'operator' => '!=',
|
|
'value' => 'publish',
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
'location' => array(
|
|
array(
|
|
array(
|
|
'param' => 'post_type',
|
|
'operator' => '==',
|
|
'value' => 'job_offer',
|
|
),
|
|
),
|
|
),
|
|
'position' => 'normal',
|
|
'style' => 'default',
|
|
)
|
|
);
|
|
}
|
|
}
|