Files
roi-theme/wp-content/plugins/wp-marketing-automations/includes/api/groupfields/class-bwfan-api-get-fields-with-groups.php
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

62 lines
1.5 KiB
PHP
Executable File

<?php
class BWFAN_API_Get_Fields_With_Groups extends BWFAN_API_Base {
public static $ins;
public $fields;
public $count_data = [];
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::READABLE;
$this->route = '/v3/groupfields';
$this->response_code = 200;
$this->fields = array();
}
public function process_api_call() {
$response = '';
try {
$fields = BWFCRM_Fields::get_groups_with_fields( false, true, true );
} catch ( Error $e ) {
$response = $e->getMessage();
}
if ( empty( $fields ) ) {
$this->response_code = 500;
$response = empty( $response ) ? __( "No fields found", "wp-marketing-automations" ) : $response;
return $this->error_response( $response );
}
$this->fields = $fields;
$address_fields = BWFCRM_Fields::get_address_fields_from_db();
$final_result = array(
'fields' => $this->fields,
'extra_fields' => $address_fields
);
$this->count_data = BWFAN_Common::get_contact_data_counts();
return $this->success_response( $final_result, __( 'Got ALL Groups with Fields', 'wp-marketing-automations' ) );
}
public function get_result_total_count() {
return count( $this->fields );
}
public function get_result_count_data() {
return $this->count_data;
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Get_Fields_With_Groups' );