aleXela
aleXela

Reputation: 1301

Connect two components octoberCms backend

cannot find a way to connect two component together. I have table in first component, and need to get the list from second and show it as drop down list. Any chance I can do it? Thanks

P.s. forget to mention. I need to get a list in back end.

Upvotes: 1

Views: 140

Answers (1)

Sozonov Alexey
Sozonov Alexey

Reputation: 75

You can use getOptions() method:

public function defineProperties()
{
    return [
        'country' => [
            'title'   => 'Country',
            'type'    => 'dropdown',
            'default' => 'us'
        ]
    ];
}

public function getCountryOptions()
{
    // here you can use DB or Model
    return ['us'=>'United states', 'ca'=>'Canada'];
}

Upvotes: 1

Related Questions