Skip to content

Commit a28bb14

Browse files
authored
Merge pull request #31 from digitalutsc/csl-inclusion-fix
Fixed csl style being included in citation list even after disabling it, Done by Sean Femouw
2 parents f875432 + 1e3cc54 commit a28bb14

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/CitationStyler.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ public function getAvailableStyles() {
9191
return $this->cslStorage->loadMultiple();
9292
}
9393

94+
/**
95+
* {@inheritdoc}
96+
*/
97+
public function getEnabledStyles() {
98+
$available_styles = $this->getAvailableStyles();
99+
foreach ($available_styles as $key => $style) {
100+
if (!$style->status()) {
101+
unset($available_styles[$key]);
102+
}
103+
}
104+
return $available_styles;
105+
}
106+
94107
/**
95108
* {@inheritdoc}
96109
*/

src/Form/SelectCitationForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getFormId() {
6969
public function buildForm(array $form, FormStateInterface $form_state) {
7070
/** @var \Drupal\citation_select\CitationStylerInterface $styler */
7171
$citation_styler = $this->styler;
72-
$citation_styles = $citation_styler->getAvailableStyles();
72+
$citation_styles = $citation_styler->getEnabledStyles();
7373
$csl_options = array_map(function ($cs) {
7474
return $cs->label();
7575
}, $citation_styles);

0 commit comments

Comments
 (0)