ClientConfig icon indicating copy to clipboard operation
ClientConfig copied to clipboard

Make current context available as placeholder in field options

Open azeller opened this issue 6 years ago • 1 comments

Summary

This issue only concerns multi-context-mode. This is more of an enhancement than a bug. In some fields it's possible to make snippet calls so tags get processed and you can for example create your own set up input options by calling pdoResources to populate them. This is not context-aware.

Step to reproduce

Try to find a context placeholder and fail at it.

Observed behavior

Me not finding the context placeholder :)

Expected behavior

Me having a [[+clientconfig.context]] placeholder of some sort, so I can do this:

[[pdoResources? 
   &tpl=`@INLINE [[+pagetitle]]==[[+id]]`
   &parents=`0`
   &limit=`0`
   &context=`[[+clientconfig.context:default=`web`]]`
   &outputSeparator=`||`
   &showHidden=`1`
]]

Environment

ClientConfig 2.1.0, MODX 2.7.1, Debian, MySQL 5.7.25, PHP 7.0.33

azeller avatar Apr 17 '19 22:04 azeller

This would likely need to be added in core/components/clientconfig/controllers/home.class.php around line 44-48. Perhaps simply $this->modx->setPlaceholder('context', $context) where $context is a validated key (currently handled around line 57-68.

Would be a cool enhancement but don't have time to build (and more importantly) test that right now.

Mark-H avatar Oct 24 '19 12:10 Mark-H