Augment tags from text field in GraphQL/REST API
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Bereich
- api, backend-api-design
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- PHP
- Sterne
- 4.9k
- Forks
- 647
- Ø Merge
- 1 T. 45 Min.
- Gemergte PRs (30 T.)
- 221
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus statamic/cms
-
forms ui
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
accessibility
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 1 Tag
-
antlers
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
Nav: link to the site root with an anchor (/#section) gets is_parent on every pageEvtl. vergeben @duncanmcclean hat das heute übernommen. Offennavigations
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
-
Multiple Choice and Checkboxes no longer offer "Inline", but the default views still use itEvtl. vergeben @duncanmcclean hat das heute übernommen. Offenforms
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
sync-en
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
Maintainer antworten meist innerhalb von 1 Tag
-
Selection on a line without a docblock tag drops trailing characters (data provider attribute)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
vimeo/psalm#15150 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
taskforcesh/bullmq#5238 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itEvtl. vergeben @bfs2021 hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Automattic/jetpack#55517 ·
Maintainer antworten meist innerhalb von 1 Tag