TopShelfCraft / Wordsmith

A plugin for Craft CMS to help you manage and manipulate text.
Other
30 stars 20 forks source link

Add basic GQL directives #47

Closed denisyilmaz closed 1 year ago

denisyilmaz commented 2 years ago

This PR adds all directives which return a string or boolean without the need to add any arguments. Arguments for directives are currently not supported as well as functions which return arrays/objects (like urlParse() or parseName()).

List of directives is based on WordsmithService::getInstance()->getMethodList().

references #46

michaelrog commented 1 year ago

I've pushed an implementation of this functionality to 4.x.dev with the intention of releasing it in 4.3.0.

For now, I went with a single @wordsmith directive, which supports any function that doesn't require arguments.

(The way Craft has implemented custom GQL Directives requires the apply() logic to be in a static context; Unfortunately, that prohibits my idea for generating/registering directives dynamically, at least for now.)