Commit 4c96f4c3 authored by Nikita Savitsky's avatar Nikita Savitsky Committed by Thomas Seidl
Browse files

Issue #3311004 by nsavitsky, drunken monkey: Fixed "All taxonomy term fields"...

Issue #3311004 by nsavitsky, drunken monkey: Fixed "All taxonomy term fields" contextual filter to include fields with custom IDs.
parent 801ec648
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
Search API 1.x, dev (xxxx-xx-xx):
---------------------------------
- #3311004 by nsavitsky, drunken monkey: Fixed "All taxonomy term fields"
  contextual filter to include fields with custom IDs.
- #3320841 by weekbeforenext, drunken monkey: Fixed indexing of "Processed text"
  fields.
- #3273159 by naveenvalecha, drunken monkey: Added the "Custom value" processor
+10 −2
Original line number Diff line number Diff line
@@ -593,6 +593,11 @@ function _search_api_views_data_special_fields(array &$table, IndexInterface $in
  $vocabulary_fields = [];
  /** @var \Drupal\search_api\Item\Field $field */
  foreach ($index->getFields() as $field_id => $field) {
    // This can only work if the field is directly on the indexed entity.
    if (str_contains($field->getPropertyPath(), IndexInterface::PROPERTY_PATH_SEPARATOR)) {
      continue;
    }

    // Search for taxonomy term reference fields, and catch problems early on.
    try {
      $property = $field->getDataDefinition();
@@ -614,6 +619,9 @@ function _search_api_views_data_special_fields(array &$table, IndexInterface $in
      continue;
    }
    $entity_type_id = $datasource->getEntityTypeId();
    if (!$entity_type_id) {
      continue;
    }
    // Field instances per bundle can reference different vocabularies, make
    // sure we add them all.
    $bundles = \Drupal::getContainer()->get('entity_type.bundle.info')
@@ -622,9 +630,9 @@ function _search_api_views_data_special_fields(array &$table, IndexInterface $in
      $bundle_fields = \Drupal::getContainer()->get('entity_field.manager')
        ->getFieldDefinitions($entity_type_id, $bundle_id);
      // Check if this bundle has the taxonomy entity reference field.
      if (array_key_exists($field->getFieldIdentifier(), $bundle_fields)) {
      if (array_key_exists($field->getPropertyPath(), $bundle_fields)) {
        /** @var \Drupal\Core\Field\FieldDefinitionInterface $field_definition */
        $field_definition = $bundle_fields[$field->getFieldIdentifier()];
        $field_definition = $bundle_fields[$field->getPropertyPath()];
        $bundle_settings = $field_definition->getSettings();
        if (!empty($bundle_settings['handler_settings']['target_bundles'])) {
          foreach ($bundle_settings['handler_settings']['target_bundles'] as $vocabulary_id) {