S
S
Sergey2016-05-01 12:48:12
MODX
Sergey, 2016-05-01 12:48:12

Modx Revo - TV @SELECT - how to insert into SELECT id of edited document?

In general, there is a TV - list (multiple choice). In admissible values ​​we do @SELECT. So. You need to make a selection of other TV parameters, or rather their values ​​in the current document being edited. In short, I can not find in the documentation how to do this.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AlexRas, 2016-05-27
@AlexRas

Maybe something from here will help -> MODX Revo API

L
Leonid S, 2019-02-14
@nornik

I will give an example for the list of resources, for the list TV will be built by analogy:
1. Create a snippet:

$objects = $modx->getCollection('modResource', [
        'deleted'   => 0,
        'published' => 1,
        'hidemenu'  => 0,
        'parent'    => $modx->resource->get('id')
    ]);

    $items = [];
    foreach ($objects as $object) {
        $items[] = $object->get('pagetitle') . '==' . $object->get('id');
    }

    return implode('||', $items);

Further in the properties of tv in the field possible values:
@EVAL return '-- Выберите --||' . $modx->runSnippet('snptName');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question