diff --git a/src/Plugin/search_api/processor/Property/.EntityReferenceWithUriProperty.php.un~ b/src/Plugin/search_api/processor/Property/.EntityReferenceWithUriProperty.php.un~ new file mode 100644 index 00000000..f6c2b132 Binary files /dev/null and b/src/Plugin/search_api/processor/Property/.EntityReferenceWithUriProperty.php.un~ differ diff --git a/src/Plugin/search_api/processor/Property/EntityReferenceWithUriProperty.php b/src/Plugin/search_api/processor/Property/EntityReferenceWithUriProperty.php index 3a084953..5197fc94 100644 --- a/src/Plugin/search_api/processor/Property/EntityReferenceWithUriProperty.php +++ b/src/Plugin/search_api/processor/Property/EntityReferenceWithUriProperty.php @@ -47,8 +47,8 @@ class EntityReferenceWithUriProperty extends ConfigurablePropertyBase { ]; $form['require_all'] = [ '#type' => 'checkbox', - '#title' => 'Require all terms', - '#description' => 'Only index related entities that have all the listed terms.', + '#title' => $this->t('Require all terms'), + '#description' => $this->t('Only index related entities that have all the listed terms.'), '#default_value' => $configuration['require_all'], ]; // Store the target type of the field, it's a pain to get it when indexing. diff --git a/src/Plugin/search_api/processor/Property/EntityReferenceWithUriProperty.php~ b/src/Plugin/search_api/processor/Property/EntityReferenceWithUriProperty.php~ new file mode 100644 index 00000000..3a084953 --- /dev/null +++ b/src/Plugin/search_api/processor/Property/EntityReferenceWithUriProperty.php~ @@ -0,0 +1,62 @@ + [], + 'require_all' => TRUE, + 'target_type' => '', + ]; + } + + /** + * {@inheritdoc} + */ + public function buildConfigurationForm(FieldInterface $field, array $form, FormStateInterface $form_state) { + $configuration = $field->getConfiguration(); + $logger = \Drupal::logger('islandora'); + $logger->info('
' . print_r($configuration['filter_terms'], TRUE) . '
'); + $form['filter_terms'] = [ + '#type' => 'entity_autocomplete', + '#target_type' => 'taxonomy_term', + '#title' => $this->t('Related entities must have this URI to be included.'), + '#tags' => TRUE, + '#default_value' => array_map(function ($element) { + return Term::load($element['target_id']); + }, array_values($configuration['filter_terms'])), + '#required' => TRUE, + ]; + $form['require_all'] = [ + '#type' => 'checkbox', + '#title' => 'Require all terms', + '#description' => 'Only index related entities that have all the listed terms.', + '#default_value' => $configuration['require_all'], + ]; + // Store the target type of the field, it's a pain to get it when indexing. + $form['target_type'] = [ + '#type' => 'hidden', + '#value' => $field->getDataDefinition()->getSetting('target_type'), + ]; + return $form; + } + +}