Skip to content

Commit c68098c

Browse files
committed
Merge branch 'pr-18' see CornellCustomDev#18
2 parents d81c272 + 2f07979 commit c68098c

File tree

6 files changed

+16
-34
lines changed

6 files changed

+16
-34
lines changed

README.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,3 @@ Required: Add an additional Service with the title “Help” and put text in e
6363
* Check out our production implementation at https://finder.research.cornell.edu
6464
* You will need to configure the SMTP module to allow the Finder module to send mail.
6565
* Installation works only at a root site, not if installed in a subdirectory.
66-
67-
## Drupal 9 changes
68-
69-
Here are some notes that may be useful if you wish to use this module with Drupal 9.
70-
71-
```
72-
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.
73-
The corrected line 231 is:
74-
$field_config = \Drupal::entityTypeManager()->getStorage('field_config')->load("paragraph" . '.' . "service_paragraphs" . '.' . $machine_name)->toArray();
75-
```
76-
77-
```
78-
src/Controller/StorageController.php lines 364, 368:
79-
Call to deprecated function drupal_set_message().
80-
Use Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
81-
Line 364: \Drupal::messenger()->addMessage($this->t('There was a problem sending your message and it was not sent.'), 'error');
82-
Line 368: \Drupal::messenger()->addMessage($this->t('Your message has been sent.'));
83-
```
84-
85-
``
86-
storage.info.yml: Add core_version_requirement: ^8 || ^9
87-
``
88-
89-
```
90-
For PHP 8: same file, at/nearline 361: implode($facets,",") . becomes implode(",",$facets) .
91-
```

finder.info.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package: Custom
44

55
type: module
66
core: 8.x
7+
core_version_requirement: ^8 || ^9 || ^10
78
dependencies:
89
- paragraphs:paragraphs
910
libraries:

finder.libraries.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ finder:
99
js:
1010
js/mustache.js: {}
1111
js/jquery.mustache.js: {}
12+
js/contrib/bootstrap.min.js: {}
1213
js/contrib/jquery.ba-throttle-debounce.min.js: {}
1314
js/contrib/jquery.detect_swipe.js: {}
1415
js/app.js: {}

js/app.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@
3030
<li>\
3131
<div class='question-wrapper'>\
3232
<h4 id='question-{{id}}'>{{question}}</h4>\
33-
<a aria-haspopup='true' class='popup' data-hidden='true' href='#explanation-{{id}}''>\
34-
<span class='fa fa-info-circle' aria-hidden='true'></span>\
35-
<span class='sr-only'>More info about {{question}}</span>\
33+
<a class='control-indicator collapsed' data-toggle='collapse' aria-expanded='false' aria-controls='#explanation-{{id}}' href='#explanation-{{id}}''>\
34+
<span class='sr-only'>Expand {{question}}</span>\
3635
</a>\
3736
</div>\
38-
<div class='help' id='explanation-{{id}}'><h3>{{question}}</h3><p>{{{description}}}</p></div>\
37+
<div class='explanation collapse' id='explanation-{{id}}'>{{{description}}}</div>\
3938
<fieldset aria-labelledby='question-{{id}}'>\
4039
{{#choices}}\
4140
<div class='checkbox' facetid='{{id}}'>\

js/contrib/bootstrap.min.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Controller/FinderController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private function createtestservicelist() {
177177
}
178178

179179

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

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

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

0 commit comments

Comments
 (0)