From 1a940a885fe98e0a4b30582e12b52ce0c0ae2d1d Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Sat, 3 Dec 2022 21:56:02 -0400 Subject: [PATCH] Add missing t() function. --- .../.EntityReferenceWithUriProperty.php.un~ | Bin 0 -> 2144 bytes .../EntityReferenceWithUriProperty.php | 4 +- .../EntityReferenceWithUriProperty.php~ | 62 ++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 src/Plugin/search_api/processor/Property/.EntityReferenceWithUriProperty.php.un~ create mode 100644 src/Plugin/search_api/processor/Property/EntityReferenceWithUriProperty.php~ 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 0000000000000000000000000000000000000000..f6c2b1325767e68e7880cf5e85246540fc3ee19c GIT binary patch literal 2144 zcmWH`%$*;a=aT=Ffhp)hVOXV1)s&gpYFocQy?%8uuX4lh24f!a7X?S>^2eQKU|_HV z;xGj;P*+Y#Elw`VEGWs$&r?^hwNp^{&&#P)$jnPgtxzaR%}FdtO;JeAE6FU$Of6O@ z$w(|w$VeH}hGmD_902KA=I;M@_$OP$N24WZhMJy;X^*{onkqHU~S^{9+ zV#F7j`k0ZaQj(EbtZP@Ip^iINL9qzS%OK~2Vi=asM`INfA~XfSSY<|zRZxa90b*Dd zrBPuH&C '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; + } + +}