JetEngine
JetEngineJetEngine CCTS

JetEngine CCTS

Integración con el plugin JetEngine de Crocoblock.

El esquema GraphQL se proporciona con campos para consultar datos de Custom Content Type (CCT).

Campos raíz

CampoDescripción
jetengineCCTEntriesDevuelve una lista de entradas CCT (tipo JetEngineCCTEntry).
jetengineCCTEntryCountDevuelve el número de entradas CCT.
jetengineCCTEntryDevuelve una única entrada CCT (tipo JetEngineCCTEntry).

El slug del CCT debe proporcionarse mediante el argumento slug (el CCT debe estar marcado como consultable en los Ajustes del plugin, ver abajo).

Tipo JetEngineCCTEntry

En el tipo JetEngineCCTEntry podemos consultar valores de campo mediante:

CampoDescripción
idEl ID de base de datos de la entrada.
uniqueIDUn identificador único para la entrada, compuesto por el slug del CCT y el ID de la entrada.
cctSlugEl slug del CCT al que pertenece esta entrada.
statusEl estado de la entrada (p. ej. publish, draft).
createdDateCuándo se creó la entrada.
createdDateStrLa fecha de creación de la entrada, formateada como cadena.
modifiedDateCuándo se modificó la entrada por última vez.
modifiedDateStrLa fecha de última modificación de la entrada, formateada como cadena.
authorIDEl ID del autor de la entrada.
authorEl objeto de conexión del usuario autor.
singleCustomPostIDEl ID del custom post único vinculado, si existe.
singleCustomPostEl objeto de conexión del custom post único vinculado.
fieldValuesUn objeto JSON con todos los campos del CCT para esa entrada.
fieldValue(slug)Para consultar un único campo por slug.

Valores de campo del CCT

Los valores de fieldValue(slug) y de cada clave en fieldValues se castean según el tipo de campo definido en el CCT.

Campos ID implícitos (siempre casteados a int cuando están presentes y no vacíos): id, singleCustomPostID, authorID.

Cómo se castea cada tipo de campo del CCT en la respuesta GraphQL:

Text (por defecto): Sin cambios (cadena o tal como se almacena).
Number: float si tiene punto decimal; de lo contrario int.
Switcher: Booleano; true para 1, true, yes, on (sin distinción entre mayúsculas y minúsculas).
Media: "ID" → int; "Both" → objeto { id, url }; en caso contrario sin cambios.
Gallery: IDs separados por comas o array de IDs → int[].
Checkbox: Array; si el campo es "tipo array" → lista de valores; en caso contrario objeto con claves.
Posts: Único → int; múltiple → int[].
Repeater: Array de filas; los subcampos se castean recursivamente por tipo.

El ejemplo siguiente usa un CCT con slug "sample_cct" y campos de diferentes tipos (text, number, gallery, etc).

Campos de un CCT
Campos de un CCT

Ejecutando la siguiente consulta:

query JetEngineCCTEntries {
  jetengineCCTEntry(cctSlug: "sample_cct", by: { id: 1 }) {
    label_text: fieldValue(slug: "label_text")
    textarea: fieldValue(slug: "textarea")
    date: fieldValue(slug: "date")
    time: fieldValue(slug: "time")
    datetime: fieldValue(slug: "datetime")
    wysisyg: fieldValue(slug: "wysisyg")
    switcher: fieldValue(slug: "switcher")
    checkbox: fieldValue(slug: "checkbox")
    checkbox_array: fieldValue(slug: "checkbox_array")
    iconpicker: fieldValue(slug: "iconpicker")
    media_id: fieldValue(slug: "media_id")
    media_url: fieldValue(slug: "media_url")
    media_array: fieldValue(slug: "media_array")
    gallery: fieldValue(slug: "gallery")
    radio: fieldValue(slug: "radio")
    repeater: fieldValue(slug: "repeater")
    options_select: fieldValue(slug: "options_select")
    options_multiple_select: fieldValue(slug: "options_multiple_select")
    number: fieldValue(slug: "number")
    colorpicker: fieldValue(slug: "colorpicker")
    post: fieldValue(slug: "post")
    posts: fieldValue(slug: "posts")
  }
}

...cada campo de la respuesta se castea a su tipo del CCT:

{
  "data": {
    "jetengineCCTEntry": {
      "label_text": "Some label",
      "textarea": "Some description here\r\n\r\nSome description there",
      "date": "2026-01-24",
      "time": "09:13",
      "datetime": "2026-03-07T08:00",
      "wysisyg": "<p>Some <strong>description</strong> here</p>\n<p><em>Some description</em> there</p>\n<p>Some <a href=\"https://gatoplugins.com\">link</a></p>\n",
      "switcher": true,
      "checkbox": {
        "one": true,
        "two": false,
        "three": true
      },
      "checkbox_array": [
        "one",
        "two"
      ],
      "iconpicker": "fa fa-road",
      "media_id": 1362,
      "media_url": "https://gatographql.com/wp-content/uploads/GatoGraphQL-logo.webp",
      "media_array": {
        "id": 1380,
        "url": "https://gatographql.com/wp-content/uploads/Funny-Dog.jpg"
      },
      "gallery": [
        1361,
        1362,
        1363
      ],
      "radio": "1",
      "repeater": [
        {
          "label_(text)": "First item in repeater",
          "date": "2026-01-17",
          "time": "11:00",
          "datetime": "2026-01-16T11:16",
          "textarea": "Gato GraphQL provides a multitude of interactive clients,",
          "wysiwyg": "<p>Gato GraphQL provides a <strong>multitude of interactive clients</strong>, and a user interface based on the <a href=\"https://wordpress.org\">WordPress editor</a>, so that anybody can operate it, whether a developer or not.</p>\n",
          "switcher": true,
          "iconpicker": "fa fa-inbox",
          "media_id": 1361,
          "media_url": "https://gatographql.com/wp-content/uploads/Funny-Dog.jpg",
          "media_array": {
            "id": 1380,
            "url": "https://gatographql.com/wp-content/uploads/Funny-Dog.jpg"
          },
          "gallery": [
            1363,
            1361
          ],
          "radio": "two",
          "options_select": "three",
          "options_multiple_select": [
            "two",
            "four"
          ],
          "number": 22,
          "colorpicker": "#757575",
          "post": 1140,
          "posts": [
            1,
            2
          ]
        },
        {
          "label_(text)": "Second item in repeater",
          "date": "2026-01-15",
          "time": "00:18",
          "datetime": "2026-01-18T00:00",
          "textarea": "These clients make it very easy to interact with Gato GraphQL",
          "wysiwyg": "<p>These clients <strong>make it very easy to interact with Gato GraphQL</strong>, directly within the <em>wp-admin</em> (and without the need of any PHP code), reducing friction and removing barriers so that anyone (developers and non-developers alike) can use it.</p>\n",
          "switcher": false,
          "iconpicker": "fa fa-search-plus",
          "media_id": 1362,
          "media_url": "https://gatographql.com/wp-content/uploads/LICENSE.txt",
          "media_array": {
            "id": 1363,
            "url": "https://gatographql.com/wp-content/uploads/LICENSE.txt"
          },
          "gallery": [
            1380,
            1361,
            1362
          ],
          "radio": "three",
          "options_select": "three",
          "options_multiple_select": [
            "three"
          ],
          "number": 4469,
          "colorpicker": "#2d2270",
          "post": 2,
          "posts": [
            1688,
            1682
          ]
        }
      ],
      "options_select": "1",
      "options_multiple_select": [
        "one",
        "two",
        "five"
      ],
      "number": 66778899,
      "colorpicker": "#721abf",
      "post": 1,
      "posts": [
        1140,
        1113
      ]
    }
  }
}

El mismo casteo de tipos se aplica a cada campo en el JSON devuelto por fieldValues:

query JetEngineCCTEntries {
  jetengineCCTEntry(cctSlug: "sample_cct", by: { id: 1 }) {
    fieldValues
  }
}

...que devuelve:

{
  "data": {
    "jetengineCCTEntry": {
      "fieldValues": {
        "label_text": "Some label",
        "textarea": "Some description here\r\n\r\nSome description there",
        "date": "2026-01-24",
        "time": "09:13",
        "datetime": "2026-03-07T08:00",
        "wysisyg": "<p>Some <strong>description</strong> here</p>\n<p><em>Some description</em> there</p>\n<p>Some <a href=\"https://gatoplugins.com\">link</a></p>\n",
        "switcher": true,
        "checkbox": {
          "one": true,
          "two": false,
          "three": true
        },
        "checkbox_array": [
          "one",
          "two"
        ],
        "iconpicker": "fa fa-road",
        "media_id": 1362,
        "media_url": "https://gatographql.com/wp-content/uploads/GatoGraphQL-logo.webp",
        "media_array": {
          "id": 1380,
          "url": "https://gatographql.com/wp-content/uploads/Funny-Dog.jpg"
        },
        "gallery": [
          1361,
          1362,
          1363
        ],
        "radio": "1",
        "repeater": [
          {
            "label_(text)": "First item in repeater",
            "date": "2026-01-17",
            "time": "11:00",
            "datetime": "2026-01-16T11:16",
            "textarea": "Gato GraphQL provides a multitude of interactive clients,",
            "wysiwyg": "<p>Gato GraphQL provides a <strong>multitude of interactive clients</strong>, and a user interface based on the <a href=\"https://wordpress.org\">WordPress editor</a>, so that anybody can operate it, whether a developer or not.</p>\n",
            "switcher": true,
            "iconpicker": "fa fa-inbox",
            "media_id": 1361,
            "media_url": "https://gatographql.com/wp-content/uploads/Funny-Dog.jpg",
            "media_array": {
              "id": 1380,
              "url": "https://gatographql.com/wp-content/uploads/Funny-Dog.jpg"
            },
            "gallery": [
              1363,
              1361
            ],
            "radio": "two",
            "options_select": "three",
            "options_multiple_select": [
              "two",
              "four"
            ],
            "number": 22,
            "colorpicker": "#757575",
            "post": 1140,
            "posts": [
              1,
              2
            ]
          },
          {
            "label_(text)": "Second item in repeater",
            "date": "2026-01-15",
            "time": "00:18",
            "datetime": "2026-01-18T00:00",
            "textarea": "These clients make it very easy to interact with Gato GraphQL",
            "wysiwyg": "<p>These clients <strong>make it very easy to interact with Gato GraphQL</strong>, directly within the <em>wp-admin</em> (and without the need of any PHP code), reducing friction and removing barriers so that anyone (developers and non-developers alike) can use it.</p>\n",
            "switcher": false,
            "iconpicker": "fa fa-search-plus",
            "media_id": 1362,
            "media_url": "https://gatographql.com/wp-content/uploads/LICENSE.txt",
            "media_array": {
              "id": 1363,
              "url": "https://gatographql.com/wp-content/uploads/LICENSE.txt"
            },
            "gallery": [
              1380,
              1361,
              1362
            ],
            "radio": "three",
            "options_select": "three",
            "options_multiple_select": [
              "three"
            ],
            "number": 4469,
            "colorpicker": "#2d2270",
            "post": 2,
            "posts": [
              1688,
              1682
            ]
          }
        ],
        "options_select": "1",
        "options_multiple_select": [
          "one",
          "two",
          "five"
        ],
        "number": 66778899,
        "colorpicker": "#721abf",
        "post": 1,
        "posts": [
          1140,
          1113
        ]
      }
    }
  }
}

Concediendo acceso a los CCTs

Por defecto, ningún CCT es consultable.

Para conceder acceso a un CCT, este debe marcarse como consultable en los Ajustes del plugin.

Hay 2 lugares donde se puede realizar esta configuración, por orden de prioridad:

  1. Personalizada: En la Configuración del Esquema correspondiente
  2. General: En la página de Ajustes

En la Configuración del Esquema aplicada al endpoint, selecciona la opción Usar configuración personalizada y luego introduce las entradas deseadas:

Definiendo los CCTs consultables en la Configuración del Esquema
Definiendo los CCTs consultables en la Configuración del Esquema

De lo contrario, se utilizarán las entradas definidas en la opción Queryable JetEngine CCTS bajo la sección JetEngine CCTS en los Ajustes:

Definiendo los CCTs consultables en los Ajustes
Definiendo los CCTs consultables en los Ajustes

Consultas de ejemplo

Listar entradas de un CCT:

query {
  jetengineCCTEntries(cctSlug: "sample_cct") {
    id
    uniqueID
    cctSlug
    status
    createdDate
    modifiedDate
    authorID
    author {
      id
      name
    }
    singleCustomPostID
    singleCustomPost {
      id
      title
    }
    fieldValues
    someField: fieldValue(slug: "some_field_slug")
  }
}

Una sola entrada CCT por slug e ID:

query {
  jetengineCCTEntry(cctSlug: "sample_cct", by: { id: 1 }) {
    id
    uniqueID
    cctSlug
    status
    createdDate
    modifiedDate
    author {
      id
      name
    }
    singleCustomPost {
      id
      title
    }
    fieldValues
    someField: fieldValue(slug: "some_field_slug")
  }
}

Listar y contar entradas CCT con filtro, paginación y orden:

query {
  jetengineCCTEntryCount(
    cctSlug: "sample_cct"
    filter: { search: [{ field: "cct_author_id", value: 1, operator: EQUALS }] }
  )
  jetengineCCTEntries(
    cctSlug: "sample_cct"
    filter: { search: [{ field: "cct_author_id", value: 1, operator: EQUALS }] }
    pagination: { limit: 10, offset: 0 }
    sort: { by: "cct_created", order: DESC }
  ) {
    id
    authorID
  }
}