Skip to content

Support Drupal 10; Move away from question description popups #18

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
26 changes: 0 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,3 @@ Required: Add an additional Service with the title “Help” and put text in e
* Check out our production implementation at https://finder.research.cornell.edu
* You will need to configure the SMTP module to allow the Finder module to send mail.
* Installation works only at a root site, not if installed in a subdirectory.

## Drupal 9 changes

Here are some notes that may be useful if you wish to use this module with Drupal 9.

```
src/Controller/StorageController.php line 231: Call to deprecated method entityManager() of class Drupal. Use Drupal::entityTypeManager() instead in most cases.If the needed method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see the deprecated \Drupal\Core\Entity\EntityManager to find the correct interface or service.
The corrected line 231 is:
$field_config = \Drupal::entityTypeManager()->getStorage('field_config')->load("paragraph" . '.' . "service_paragraphs" . '.' . $machine_name)->toArray();
```

```
src/Controller/StorageController.php lines 364, 368:
Call to deprecated function drupal_set_message().
Use Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
Line 364: \Drupal::messenger()->addMessage($this->t('There was a problem sending your message and it was not sent.'), 'error');
Line 368: \Drupal::messenger()->addMessage($this->t('Your message has been sent.'));
```

``
storage.info.yml: Add core_version_requirement: ^8 || ^9
``

```
For PHP 8: same file, at/nearline 361: implode($facets,",") . becomes implode(",",$facets) .
```
1 change: 1 addition & 0 deletions finder.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package: Custom

type: module
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
dependencies:
- paragraphs:paragraphs
libraries:
Expand Down
1 change: 1 addition & 0 deletions finder.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ finder:
js:
js/mustache.js: {}
js/jquery.mustache.js: {}
js/contrib/bootstrap.min.js: {}
js/contrib/jquery.ba-throttle-debounce.min.js: {}
js/contrib/jquery.detect_swipe.js: {}
js/app.js: {}
Expand Down
7 changes: 3 additions & 4 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@
<li>\
<div class='question-wrapper'>\
<h4 id='question-{{id}}'>{{question}}</h4>\
<a aria-haspopup='true' class='popup' data-hidden='true' href='#explanation-{{id}}''>\
<span class='fa fa-info-circle' aria-hidden='true'></span>\
<span class='sr-only'>More info about {{question}}</span>\
<a class='control-indicator collapsed' data-toggle='collapse' aria-expanded='false' aria-controls='#explanation-{{id}}' href='#explanation-{{id}}''>\
<span class='sr-only'>Expand {{question}}</span>\
</a>\
</div>\
<div class='help' id='explanation-{{id}}'><h3>{{question}}</h3><p>{{{description}}}</p></div>\
<div class='explanation collapse' id='explanation-{{id}}'>{{{description}}}</div>\
<fieldset aria-labelledby='question-{{id}}'>\
{{#choices}}\
<div class='checkbox' facetid='{{id}}'>\
Expand Down
7 changes: 7 additions & 0 deletions js/contrib/bootstrap.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/Controller/FinderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private function createtestservicelist() {
}


$field_config = \Drupal::entityManager()->getStorage('field_config')->load("paragraph" . '.' . "service_paragraphs" . '.' . $machine_name)->toArray();
$field_config = \Drupal::entityTypeManager()->getStorage('field_config')->load("paragraph" . '.' . "service_paragraphs" . '.' . $machine_name)->toArray();

$field_data["label"] = $field_config["label"];
$field_data["weight"] = $pdcontent[$machine_name]["weight"];
Expand Down Expand Up @@ -279,7 +279,7 @@ public function send_email() {
"with your criteria already selected: " .
\Drupal::request()->getSchemeAndHttpHost() .
"/finder?facets=" .
implode($facets,",") .
implode(",", $facets) .
"\r\n\r\n" .
"If you have any further questions or need more information about " .
"Finder services, please contact the helpdesk to set up a consultation, ".
Expand All @@ -306,11 +306,11 @@ public function send_email() {
$result = $mailManager->mail($module, $key, $to, $langcode, $params, NULL, $send);

if ($result['result'] !== true) {
drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');
Drupal::messenger()->addMessage($this->t('There was a problem sending your message and it was not sent.'), 'error');
return new JsonResponse("problem");
}
else {
drupal_set_message(t('Your message has been sent.'));
Drupal::messenger()->addMessage($this->t('Your message has been sent.'));
return new JsonResponse("success");
}

Expand Down