Augment tags from text field in GraphQL/REST API
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 25/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Domínio
- api, backend-api-design
Direção de pesquisa
Start by reading the GraphQL and REST API entry points that serialize text fields, then compare their behavior with Antlers template rendering and how custom tags are evaluated. The issue does not name files or tests, so first locate those paths and check for existing coverage. Done means tag expressions in text fields are handled consistently in API responses, with tests covering the reported example.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Bug description
I have a text field with this in
Random {{ custom:wrap text="nonsense" }} news in your inbox. Once a month.
and a custom tag set up like this:
<?php
namespace App\Tags;
use Statamic\Tags\Tags;
class Custom extends Tags
{
/**
* The {{ custom:wrap text="Title text" }} tag
*
* @return string|array
*/
public function wrap()
{
$text = $this->params->get('text', null);
$random_int = random_int(1, 7);
$length_class = "sketch-short sketch-short--" . $random_int;
if (strlen($text) > 8) {
$random_int = random_int(1, 2);
$length_class = "sketch-long sketch-long--" . $random_int;
}
return '<span class="sketch ' . $length_class . '">' . $text . '</span>';
}
}
When outputting the value in an antlers template it gets evaluated, but in the REST API or GraphQL it just returns the plain string.
Could a custom GraphQL middleware solve this?
How to reproduce
- Set up custom Tag
- use tag in regular text field
- query with graphql or rest api
Logs
No response
Environment
Environment
Application Name: Statamic
Laravel Version: 9.39.0
PHP Version: 8.1.11
Composer Version: 2.4.3
Environment: local
Debug Mode: ENABLED
URL: asdf.test
Maintenance Mode: OFF
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Addons: 0
Antlers: regex
Version: 3.3.54 PRO
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
runtime (new)
Additional details
No response
- Linguagem predominante
- PHP
- Estrelas
- 4.9k
- Forks
- 647
- Merge médio
- 1d 45min
- PRs com merge (30d)
- 221
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de statamic/cms
-
forms ui
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
accessibility
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
antlers
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 1 dia
-
Nav: link to the site root with an anchor (/#section) gets is_parent on every pageTalvez já em andamento @duncanmcclean assumiu hoje. Abertanavigations
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
-
Multiple Choice and Checkboxes no longer offer "Inline", but the default views still use itTalvez já em andamento @duncanmcclean assumiu hoje. Abertaforms
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
Todas as issues de statamic/cms
Issues semelhantes
-
sync-en
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 1 dia
-
Selection on a line without a docblock tag drops trailing characters (data provider attribute)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
vimeo/psalm#15150 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
taskforcesh/bullmq#5238 ·
Mantenedores costumam responder em até 1 dia
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itTalvez já em andamento @bfs2021 assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Automattic/jetpack#55517 ·
Mantenedores costumam responder em até 1 dia