Active
Project:
Selectize.js
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 Mar 2024 at 12:00 UTC
Updated:
29 Mar 2024 at 12:00 UTC
Jump to comment: Most recent
How would I be able to use this in code with an entity reference view as the selection settings. I currently have the following that works to select all profile nodes :
$form['profile'] = [
'#type' => 'selectize_entity_autocomplete',
'#target_type' => 'node',
'#title' => $this->t('Profile'),
'#title_display' => 'none',
'#settings' => [
'maxItems' => 1,
'delimiter' => ', ',
'closeAfterSelect' => true,
'plugins' => ['remove_button'],
],
'#selection_settings' => [
'target_bundles' => ['profile']
],
'#required' => TRUE,
];
I want to be able to use an entity reference view instead of getting all profile nodes. I tried this but it doesnt work :
$form['profile'] = [
'#type' => 'selectize_entity_autocomplete',
'#target_type' => 'node',
'#title' => $this->t('Profile'),
'#title_display' => 'none',
'#settings' => [
'maxItems' => 1,
'delimiter' => ', ',
'closeAfterSelect' => true,
'plugins' => ['remove_button'],
],
'#selection_settings' => [
'view' => [
'view_name' => 'profile_reference',
'display_name' => 'enity_reference_profiles',
'arguments' => []
],
'match_operator' => 'CONTAINS'
],
'#required' => TRUE,
];
Any help would be much appreciated.
Comments