Working on https://github.com/marthinal/hselect2 , I need to add this new field as a possible filter.
So to explain a little bit, when you have a taxonomy term field(entity reference) and and you want to add it as exposed filter, you can select Autocomplete or a Select by default. This is because we are using the plugin with the id taxonomy_index_tid.
This plugin is added here
function taxonomy_field_views_data_alter(array &$data, FieldStorageConfigInterface $field_storage) {
if ($field_storage->getType() == 'entity_reference' && $field_storage->getSetting('target_type') == 'taxonomy_term') {
foreach ($data as $table_name => $table_data) {
foreach ($table_data as $field_name => $field_data) {
if (isset($field_data['filter']) && $field_name != 'delta') {
$data[$table_name][$field_name]['filter']['id'] = 'taxonomy_index_tid';
}
}
}
}
}
from a hook_field_views_data_alter().
If I want to add extra options I need to create a new plugin and try to add this new plugin id using the same hook.
Well, the plugin will be always 'taxonomy_index_tid'. I can only use the other plugin commenting this line
$data[$table_name][$field_name]['filter']['id'] = 'taxonomy_index_tid';
I'm not sure if I'm missing something and I don't think that I need to check the module weight each time I want to create a plugin or something like that... otherwise this is a bug at least.
Comment | File | Size | Author |
---|---|---|---|
viewsfilter.png | 50.09 KB | marthinal |
Comments
Comment #1
googletorp CreditAttribution: googletorp at Reveal IT commentedIs this a support request or a bug report?
Comment #10
quietone CreditAttribution: quietone as a volunteer commentedIt looks more like a support request to me as well.
marthinal, has this problem been resolved?
Comment #12
cilefen CreditAttribution: cilefen commentedI am closing this support request because there have been no recent comments.