Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-205: Allow SSL + fix Drupal 10.3.1 exception when layout builder is disabled #206

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,22 @@ public function updateFacetCache(ViewsBulkOperationsEvent $event) {
// We do not know here if facets will or not be in a f[] so we pass
// all values (also good, respects filters).
// The VBO URL facet processor will know/read from the URL Processor settings.
// Do not overridewrite once the batch starts or we will end with 0 filters.
// Do not override once the batch starts or we will end with 0 filters.
// Arguments will be 'op' = 'do', _format = 'json', id = a number the batch id
// Normally just checking if this is happening under the unbrella of the actual Views Route is enough
// BUT ... we need to also take in account layout builder .. so in that case we check for 'op' !== do && id (the batch)
// @TODO. No idea how to deal with the blocks and other options
// I could to the opposite> Save it anytime it is not a batch but bc Facets are basically processed all the time
// I could to the opposite: Save it anytime it is not a batch but bc Facets are basically processed all the time
// anywhere that would be a lot of extra processing time.
// Add work around for users that disabled "layout builder"
$is_layout_builder = NULL;
$route_object = \Drupal::routeMatch()->getRouteObject();
if ($route_object) {
$is_layout_builder = $route_object->getOption('_layout_builder');
}
if ((\Drupal::routeMatch()->getRouteName() == 'view'. '.' . $event->getView()->id(). '.' .$event->getView()->current_display) ||
(
(\Drupal::routeMatch()->getRouteObject()->getOption('_layout_builder') ||
($is_layout_builder ||
$event->getView()->display_handler->getBaseId() == 'block') && (($exposed_input['op'] ?? NULL) !== "do") && !isset($exposed_input['id']))
) {
$this->tempStoreFactory->get($tempStoreName)->set(
Expand Down
28 changes: 24 additions & 4 deletions src/Plugin/ImporterAdapter/SolrImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,18 @@ public function interactiveForm(array $parents, FormStateInterface $form_state):
'#default_value' => $form_state->getValue(array_merge($parents,
['solarium_config', 'islandora_collection'])),
],
'scheme' => [
'#type' => 'radios',
'#required' => TRUE,
'#title' => $this->t('The Scheme (protocol) of your Solr Server'),
'#options' => [
'http' => 'HTTP',
'https' => 'HTTPS'
],
'#description' => $this->t('If you port is 443 most likely your scheme is going to be HTTPS.'),
'#default_value' => $form_state->getValue(array_merge($parents,
['solarium_config', 'schema'])),
],
'host' => [
'#type' => 'textfield',
'#required' => TRUE,
Expand Down Expand Up @@ -344,8 +356,8 @@ public function interactiveForm(array $parents, FormStateInterface $form_state):
'#required' => FALSE,
'#description_display' => 'before',
'#description' => $this->t('Additional Datastreams to fetch. <em>OBJ</em> datastream will always be fetched. Not all datastreams listed here might be present once your data is fetched.'),
'#default_value' => $datastreams_values_combined,
'#options' => $datastreams_source,
'#default_value' => $datastreams_values_combined ?? [],
'#options' => $datastreams_source ?? [],
],
'datastreams_how' => [
'#access' => !empty($cmodels),
Expand Down Expand Up @@ -437,6 +449,7 @@ public static function validateSolrConfig($element, FormStateInterface $form_sta
'endpoint' => [
'amiremote' => [
'host' => $config['host'],
'scheme' => $config['scheme'] ?? 'http',
'port' => $config['port'],
'path' => $config['path'],
],
Expand Down Expand Up @@ -470,7 +483,9 @@ public static function validateSolrConfig($element, FormStateInterface $form_sta
$result = $client->ping($ping);
} catch (\Exception $e) {
$form_state->setError($element,
t('Ups. We could not contact your server. Check if your settings are correct and/or firewalls are open for this IP address.'));
t('Ups. We could not contact your server. Check if your settings are correct and/or firewalls are open for this IP address. Remote error is @e', [
'@e' => $e->getMessage()
]));
}
}

Expand All @@ -493,6 +508,7 @@ public function getInfo(array $config, FormStateInterface $form_state, $page = 0
'endpoint' => [
'amiremote' => [
'host' => $config['solarium_config']['host'],
'scheme' => $config['solarium_config']['scheme'],
'port' => $config['solarium_config']['port'],
'path' => $config['solarium_config']['path'],
],
Expand Down Expand Up @@ -521,7 +537,10 @@ public function getInfo(array $config, FormStateInterface $form_state, $page = 0
$ping_sucessful = $result->getData();
} catch (\Exception $e) {
$form_state->setError($element,
$this->t('Ups. We could not contact your server. Check if your settings,ports,core,etc are correct and/or firewalls are open for this IP address.'));
$this->t('Ups. We could not contact your server. Check if your settings,ports,core,etc are correct and/or firewalls are open for this IP address. The error thrown is: @e',
[
'@e' => $e->getMessage()
]));
$form_state->setValue(['pluginconfig','ready'], FALSE);
return $tabdata;
}
Expand Down Expand Up @@ -779,6 +798,7 @@ public function getData(array $config, $page = 0, $per_page = 20): array {
'endpoint' => [
'amiremote' => [
'host' => $config['solarium_config']['host'],
'scheme' => $config['solarium_config']['scheme'] ?? 'http',
'port' => $config['solarium_config']['port'],
'path' => $config['solarium_config']['path'],
],
Expand Down