Skip to content
Snippets Groups Projects
Commit cb230b71 authored by catch's avatar catch
Browse files

Issue #3187643 by spokje, acbramley, quietone: Make Node views wizard buildFilters more efficient

parent 87c85acb
No related branches found
No related tags found
3 merge requests!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #482460 passed with warnings
Pipeline: drupal

#482465

    ......@@ -277,17 +277,13 @@ protected function buildFilters(&$form, FormStateInterface $form_state) {
    $tag_fields = [];
    foreach ($bundles as $bundle) {
    $display = $this->entityDisplayRepository->getFormDisplay($this->entityTypeId, $bundle);
    $taxonomy_fields = array_filter($this->entityFieldManager->getFieldDefinitions($this->entityTypeId, $bundle), function (FieldDefinitionInterface $field_definition) {
    return $field_definition->getType() == 'entity_reference' && $field_definition->getSetting('target_type') == 'taxonomy_term';
    });
    foreach ($taxonomy_fields as $field_name => $field) {
    $widget = $display->getComponent($field_name);
    // We define "tag-like" taxonomy fields as ones that use the
    // "Autocomplete (Tags style)" widget.
    if (!empty($widget) && $widget['type'] == 'entity_reference_autocomplete_tags') {
    $tag_fields[$field_name] = $field;
    $tag_fields += array_filter($this->entityFieldManager->getFieldDefinitions($this->entityTypeId, $bundle), function (FieldDefinitionInterface $field_definition) use ($display) {
    if ($field_definition->getType() == 'entity_reference' && $field_definition->getSetting('target_type') == 'taxonomy_term') {
    $widget = $display->getComponent($field_definition->getName());
    return isset($widget['type']) && $widget['type'] == 'entity_reference_autocomplete_tags';
    }
    }
    return FALSE;
    });
    }
    if (!empty($tag_fields)) {
    // If there is more than one "tag-like" taxonomy field available to
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment