Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How do I express in this select volt?

echo $this->tag->select(
array(
    'productId',
    Products::find("type = 'vegetables'"),
    'using'      => array('id', "name"),
    'useEmpty'   => true,
    'emptyText'  => 'Please, choose one...',
    'emptyValue' => '@'
)
);


2.7k
Accepted
answer
{{ select('productId', products, 'using': ['id', 'name'], 'useEmpty': true, 'emptyText': 'Please, choose one...', 'emptyValue': '@' ) }}

With products set in the controller

$this->view->setVar('products', Products::find("type = 'vegetables'"));