Finales felices (con revisión) y apadrinamiento, preparados y ocultos

- Formulario [ga_final_feliz]: las familias envían texto y foto (solo imágenes reales ≤5 MB,
  límite de envíos, consentimiento de publicación). Queda pendiente hasta que el equipo
  la publica; aviso por correo y contador en el menú.
- Sección «Finales felices»: historias aprobadas o, si no hay, los adoptados.
- Casilla «Busca padrino o madrina», sección «Apadrina» y motivo de contacto (sin pagos).
- Páginas «Finales felices / Amaiera zoriontsuak» creadas como borrador.
- API: profile.sponsorable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 10:30:53 +02:00
parent fac5e6035c
commit 1ad21c1b08
12 changed files with 293 additions and 23 deletions

View File

@@ -40,6 +40,7 @@ function ga_api_map() {
return array(
'status' => 'estado',
'featured' => 'destacado',
'sponsorable' => 'apadrinable',
'sex' => 'sexo',
'birthDate' => 'nacimiento',
'age' => 'edad',
@@ -73,6 +74,7 @@ function ga_animal_api_data( $post_id ) {
$data = array(
'status' => ga_api_to( 'estado', ga_status( $post_id ) ),
'featured' => (bool) ga_get( $post_id, 'destacado' ),
'sponsorable' => (bool) ga_get( $post_id, 'apadrinable' ),
'sex' => ga_api_to( 'sexo', ga_get( $post_id, 'sexo' ) ),
'birthDate' => $text( 'nacimiento' ),
'age' => '' === ga_get( $post_id, 'edad' ) ? null : (float) ga_get( $post_id, 'edad' ),
@@ -116,6 +118,7 @@ function ga_animal_api_update( array $profile, $post_id ) {
}
break;
case 'featured':
case 'sponsorable':
$value = $raw ? '1' : '';
break;
case 'age':
@@ -157,6 +160,7 @@ function ga_animal_api_schema() {
'properties' => array(
'status' => array( 'type' => 'string', 'enum' => array_values( ga_api_enums()['estado'] ), 'description' => 'Adopted animals are hidden from public listings.' ),
'featured' => array( 'type' => 'boolean', 'description' => 'Shown on the home page.' ),
'sponsorable' => array( 'type' => 'boolean', 'description' => 'Looking for a sponsor.' ),
'sex' => $enum( 'sexo' ),
'birthDate' => $string_or_null + array( 'format' => 'date' ),
'age' => array( 'type' => array( 'number', 'null' ), 'description' => 'Approximate age, used when birthDate is unknown.' ),
@@ -211,6 +215,7 @@ add_action( 'graphql_register_types', function () {
'fields' => array(
'status' => array( 'type' => 'AnimalStatusEnum' ),
'featured' => array( 'type' => 'Boolean' ),
'sponsorable' => array( 'type' => 'Boolean' ),
'sex' => array( 'type' => 'AnimalSexEnum' ),
'birthDate' => array( 'type' => 'String' ),
'age' => array( 'type' => 'Float' ),