docs icon indicating copy to clipboard operation
docs copied to clipboard

Evaluation setting `context`

Open ausi opened this issue 4 years ago • 2 comments

The picker input type supports the evaluation context like 'eval' => ['context' => 'dc.tl_content']. This is currently not documented.

Related: #687 #656

ausi avatar Apr 12 '21 07:04 ausi

Is 'eval' => ['context' => 'dc.tl_content'] any different from 'relation' => ['table' => 'tl_content']? /cc @aschempp

fritzmg avatar May 14 '22 20:05 fritzmg

The context is not necessarily a table, but it tells the picker what should be picked. The default picker context is link, which is what we use to "pick" insert tags for a text field. Any picker can support any context, and multiple pickers can support the same context. That's how a link can be picked for news, articles, events or pages.

The dc. is a special prefix for the Universal Picker Widget that can pick from any DCA table (if its driver supports pickers). The universal picker widget will use the related table as dc. context if no context is given.

As an example, the FilePickerProvider also supports the file context, where you can pick files that might not belong to tl_files yet. And e.g. https://extensions.contao.org/?p=terminal42%2Fcontao-bynder supports the file context as well, which means with that extension anyone picking files can pick something from a remote system (in this case it will transparently download the file in the background).

aschempp avatar Jun 22 '22 07:06 aschempp