Files
roi-theme/wp-content/plugins/wp-marketing-automations/includes/api/groupfields/class-bwfan-api-create-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

53 lines
1.0 KiB
PHP
Executable File

<?php
class BWFAN_API_Create_Groups extends BWFAN_API_Base {
public static $ins;
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public function default_args_values() {
$args = array(
'group_name' => '',
);
return $args;
}
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::CREATABLE;
$this->route = '/v3/groupfields';
$this->response_code = 200;
}
public function process_api_call() {
/**
* getting post data
*/
$group_name = $this->get_sanitized_arg( 'group_name', 'text_field' );
if ( empty( $group_name ) ) {
$this->response_code = 400;
return $this->error_response( __( "Required group missing", "wp-marketing-automations" ) );
}
$group = BWFCRM_Group::add_group( $group_name );
$response = __( 'Field group created', 'wp-marketing-automations' );
return $this->success_response( $group, $response );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Create_Groups' );