post_id > 0 ? $ctx->post_id : false); } public function options(string $control, string $search, Context $ctx): array { if ($control !== 'key' || !function_exists('acf_get_field_groups') || !function_exists('acf_get_fields')) { return []; } $out = []; foreach ((array) acf_get_field_groups() as $group) { foreach ((array) acf_get_fields($group) as $field) { if (is_array($field) && isset($field['name']) && is_string($field['name']) && $field['name'] !== '') { $label = is_string($field['label'] ?? null) && $field['label'] !== '' ? $field['label'] : $field['name']; $out[] = ['value' => $field['name'], 'label' => $label]; } } } return self::filter_options($out, $search); } }