Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Alexander O'Neill | f4ca77eaa8 | 6 years ago |
23 changed files with 121 additions and 1023 deletions
@ -1,11 +1,10 @@ |
|||||||
name: 'BibCite Footnotes' |
name: 'BibCite Footnotes' |
||||||
type: module |
type: module |
||||||
description: 'Inline footnote links for BibCite References' |
description: 'Inline footnote links for BibCite References' |
||||||
core_version_requirement: ^8.0 || ^9 || ^10 |
core: 8.x |
||||||
package: 'Bibliography & Citation' |
package: 'Bibliography & Citation' |
||||||
dependencies: |
dependencies: |
||||||
- bibcite:bibcite |
- bibcite:bibcite |
||||||
- bibcite:bibcite_entity |
- bibcite:bibcite_entity |
||||||
- fakeobjects:fakeobjects |
- entity_reference |
||||||
|
- footnotes:footnotes |
||||||
|
|
||||||
|
@ -1,4 +0,0 @@ |
|||||||
Description |
|
||||||
----------- |
|
||||||
|
|
||||||
Example content type and text format to demonstrate a fully-configured Reference Footnotes setup. |
|
@ -1,13 +0,0 @@ |
|||||||
name: 'BibCite Footnotes Article with Citations' |
|
||||||
type: module |
|
||||||
description: 'Example module to show a fully-configured content type and text format with Reference Footnotes.' |
|
||||||
core_version_requirement: ^8 || ^9 || ^10 |
|
||||||
package: 'Bibliography & Citation' |
|
||||||
dependencies: |
|
||||||
- bibcite_footnotees:bibcite_footnotes |
|
||||||
- bibcite:bibcite_import |
|
||||||
- bibcite:bibcite_bibtex |
|
||||||
- bibcite:bibcite_endnote |
|
||||||
- bibcite:bibcite_ris |
|
||||||
- bibcite:bibcite_marc |
|
||||||
- inline_entity_form:inline_entity_form |
|
@ -1,113 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
config: |
|
||||||
- field.field.node.bibcite_fn_article_references.body |
|
||||||
- field.field.node.bibcite_fn_article_references.field_bibcite_fn_works_cited |
|
||||||
- field.field.node.bibcite_fn_article_references.field_image |
|
||||||
- field.field.node.bibcite_fn_article_references.field_tags |
|
||||||
- image.style.thumbnail |
|
||||||
- node.type.bibcite_fn_article_references |
|
||||||
module: |
|
||||||
- image |
|
||||||
- inline_entity_form |
|
||||||
- path |
|
||||||
- text |
|
||||||
id: node.bibcite_fn_article_references.default |
|
||||||
targetEntityType: node |
|
||||||
bundle: bibcite_fn_article_references |
|
||||||
mode: default |
|
||||||
content: |
|
||||||
body: |
|
||||||
type: text_textarea_with_summary |
|
||||||
weight: 7 |
|
||||||
settings: |
|
||||||
rows: 9 |
|
||||||
summary_rows: 3 |
|
||||||
placeholder: '' |
|
||||||
third_party_settings: { } |
|
||||||
region: content |
|
||||||
created: |
|
||||||
type: datetime_timestamp |
|
||||||
weight: 2 |
|
||||||
region: content |
|
||||||
settings: { } |
|
||||||
third_party_settings: { } |
|
||||||
field_bibcite_fn_works_cited: |
|
||||||
weight: 8 |
|
||||||
settings: |
|
||||||
form_mode: default |
|
||||||
label_singular: '' |
|
||||||
label_plural: '' |
|
||||||
allow_new: true |
|
||||||
allow_existing: true |
|
||||||
match_operator: CONTAINS |
|
||||||
override_labels: false |
|
||||||
collapsible: false |
|
||||||
collapsed: false |
|
||||||
allow_duplicate: false |
|
||||||
third_party_settings: { } |
|
||||||
type: inline_entity_form_complex |
|
||||||
region: content |
|
||||||
field_image: |
|
||||||
weight: 10 |
|
||||||
settings: |
|
||||||
progress_indicator: throbber |
|
||||||
preview_image_style: thumbnail |
|
||||||
third_party_settings: { } |
|
||||||
type: image_image |
|
||||||
region: content |
|
||||||
field_tags: |
|
||||||
weight: 9 |
|
||||||
settings: |
|
||||||
match_operator: CONTAINS |
|
||||||
size: 60 |
|
||||||
placeholder: '' |
|
||||||
third_party_settings: { } |
|
||||||
type: entity_reference_autocomplete |
|
||||||
region: content |
|
||||||
path: |
|
||||||
type: path |
|
||||||
weight: 5 |
|
||||||
region: content |
|
||||||
settings: { } |
|
||||||
third_party_settings: { } |
|
||||||
promote: |
|
||||||
type: boolean_checkbox |
|
||||||
settings: |
|
||||||
display_label: true |
|
||||||
weight: 3 |
|
||||||
region: content |
|
||||||
third_party_settings: { } |
|
||||||
status: |
|
||||||
type: boolean_checkbox |
|
||||||
settings: |
|
||||||
display_label: true |
|
||||||
weight: 6 |
|
||||||
region: content |
|
||||||
third_party_settings: { } |
|
||||||
sticky: |
|
||||||
type: boolean_checkbox |
|
||||||
settings: |
|
||||||
display_label: true |
|
||||||
weight: 4 |
|
||||||
region: content |
|
||||||
third_party_settings: { } |
|
||||||
title: |
|
||||||
type: string_textfield |
|
||||||
weight: 0 |
|
||||||
region: content |
|
||||||
settings: |
|
||||||
size: 60 |
|
||||||
placeholder: '' |
|
||||||
third_party_settings: { } |
|
||||||
uid: |
|
||||||
type: entity_reference_autocomplete |
|
||||||
weight: 1 |
|
||||||
settings: |
|
||||||
match_operator: CONTAINS |
|
||||||
size: 60 |
|
||||||
placeholder: '' |
|
||||||
region: content |
|
||||||
third_party_settings: { } |
|
||||||
hidden: { } |
|
@ -1,57 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
config: |
|
||||||
- field.field.node.bibcite_fn_article_references.body |
|
||||||
- field.field.node.bibcite_fn_article_references.field_bibcite_fn_works_cited |
|
||||||
- field.field.node.bibcite_fn_article_references.field_image |
|
||||||
- field.field.node.bibcite_fn_article_references.field_tags |
|
||||||
- node.type.bibcite_fn_article_references |
|
||||||
module: |
|
||||||
- image |
|
||||||
- text |
|
||||||
- user |
|
||||||
id: node.bibcite_fn_article_references.default |
|
||||||
targetEntityType: node |
|
||||||
bundle: bibcite_fn_article_references |
|
||||||
mode: default |
|
||||||
content: |
|
||||||
body: |
|
||||||
label: hidden |
|
||||||
type: text_default |
|
||||||
weight: 1 |
|
||||||
settings: { } |
|
||||||
third_party_settings: { } |
|
||||||
region: content |
|
||||||
field_bibcite_fn_works_cited: |
|
||||||
weight: 2 |
|
||||||
label: above |
|
||||||
settings: |
|
||||||
view_mode: citation |
|
||||||
link: false |
|
||||||
third_party_settings: { } |
|
||||||
type: entity_reference_entity_view |
|
||||||
region: content |
|
||||||
field_image: |
|
||||||
weight: 4 |
|
||||||
label: above |
|
||||||
settings: |
|
||||||
image_style: '' |
|
||||||
image_link: '' |
|
||||||
third_party_settings: { } |
|
||||||
type: image |
|
||||||
region: content |
|
||||||
field_tags: |
|
||||||
weight: 3 |
|
||||||
label: above |
|
||||||
settings: |
|
||||||
link: true |
|
||||||
third_party_settings: { } |
|
||||||
type: entity_reference_label |
|
||||||
region: content |
|
||||||
links: |
|
||||||
weight: 0 |
|
||||||
region: content |
|
||||||
settings: { } |
|
||||||
third_party_settings: { } |
|
||||||
hidden: { } |
|
@ -1,51 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
config: |
|
||||||
- filter.format.basic_html_with_references |
|
||||||
module: |
|
||||||
- ckeditor |
|
||||||
format: basic_html_with_references |
|
||||||
editor: ckeditor |
|
||||||
settings: |
|
||||||
toolbar: |
|
||||||
rows: |
|
||||||
- |
|
||||||
- |
|
||||||
name: Formatting |
|
||||||
items: |
|
||||||
- Bold |
|
||||||
- Italic |
|
||||||
- |
|
||||||
name: Links |
|
||||||
items: |
|
||||||
- DrupalLink |
|
||||||
- DrupalUnlink |
|
||||||
- |
|
||||||
name: Lists |
|
||||||
items: |
|
||||||
- BulletedList |
|
||||||
- NumberedList |
|
||||||
- |
|
||||||
name: Media |
|
||||||
items: |
|
||||||
- Blockquote |
|
||||||
- DrupalImage |
|
||||||
- |
|
||||||
name: Tools |
|
||||||
items: |
|
||||||
- Source |
|
||||||
- reference_footnotes |
|
||||||
plugins: |
|
||||||
stylescombo: |
|
||||||
styles: '' |
|
||||||
language: |
|
||||||
language_list: un |
|
||||||
image_upload: |
|
||||||
status: false |
|
||||||
scheme: public |
|
||||||
directory: inline-images |
|
||||||
max_size: '' |
|
||||||
max_dimensions: |
|
||||||
width: null |
|
||||||
height: null |
|
@ -1,21 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
config: |
|
||||||
- field.storage.node.body |
|
||||||
- node.type.bibcite_fn_article_references |
|
||||||
module: |
|
||||||
- text |
|
||||||
id: node.bibcite_fn_article_references.body |
|
||||||
field_name: body |
|
||||||
entity_type: node |
|
||||||
bundle: bibcite_fn_article_references |
|
||||||
label: Body |
|
||||||
description: '' |
|
||||||
required: false |
|
||||||
translatable: true |
|
||||||
default_value: { } |
|
||||||
default_value_callback: '' |
|
||||||
settings: |
|
||||||
display_summary: true |
|
||||||
field_type: text_with_summary |
|
@ -1,98 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
config: |
|
||||||
- bibcite_entity.bibcite_reference_type.artwork |
|
||||||
- bibcite_entity.bibcite_reference_type.audiovisual |
|
||||||
- bibcite_entity.bibcite_reference_type.bill |
|
||||||
- bibcite_entity.bibcite_reference_type.book |
|
||||||
- bibcite_entity.bibcite_reference_type.book_chapter |
|
||||||
- bibcite_entity.bibcite_reference_type.broadcast |
|
||||||
- bibcite_entity.bibcite_reference_type.case |
|
||||||
- bibcite_entity.bibcite_reference_type.chart |
|
||||||
- bibcite_entity.bibcite_reference_type.classical |
|
||||||
- bibcite_entity.bibcite_reference_type.conference_paper |
|
||||||
- bibcite_entity.bibcite_reference_type.conference_proceedings |
|
||||||
- bibcite_entity.bibcite_reference_type.database |
|
||||||
- bibcite_entity.bibcite_reference_type.film |
|
||||||
- bibcite_entity.bibcite_reference_type.government_report |
|
||||||
- bibcite_entity.bibcite_reference_type.hearing |
|
||||||
- bibcite_entity.bibcite_reference_type.journal |
|
||||||
- bibcite_entity.bibcite_reference_type.journal_article |
|
||||||
- bibcite_entity.bibcite_reference_type.legal_ruling |
|
||||||
- bibcite_entity.bibcite_reference_type.magazine_article |
|
||||||
- bibcite_entity.bibcite_reference_type.manuscript |
|
||||||
- bibcite_entity.bibcite_reference_type.map |
|
||||||
- bibcite_entity.bibcite_reference_type.miscellaneous |
|
||||||
- bibcite_entity.bibcite_reference_type.miscellaneous_section |
|
||||||
- bibcite_entity.bibcite_reference_type.newspaper_article |
|
||||||
- bibcite_entity.bibcite_reference_type.patent |
|
||||||
- bibcite_entity.bibcite_reference_type.personal |
|
||||||
- bibcite_entity.bibcite_reference_type.presentation |
|
||||||
- bibcite_entity.bibcite_reference_type.report |
|
||||||
- bibcite_entity.bibcite_reference_type.software |
|
||||||
- bibcite_entity.bibcite_reference_type.statute |
|
||||||
- bibcite_entity.bibcite_reference_type.thesis |
|
||||||
- bibcite_entity.bibcite_reference_type.unpublished |
|
||||||
- bibcite_entity.bibcite_reference_type.web_article |
|
||||||
- bibcite_entity.bibcite_reference_type.web_project_page |
|
||||||
- bibcite_entity.bibcite_reference_type.web_service |
|
||||||
- bibcite_entity.bibcite_reference_type.website |
|
||||||
- field.storage.node.field_bibcite_fn_works_cited |
|
||||||
- node.type.bibcite_fn_article_references |
|
||||||
id: node.bibcite_fn_article_references.field_bibcite_fn_works_cited |
|
||||||
field_name: field_bibcite_fn_works_cited |
|
||||||
entity_type: node |
|
||||||
bundle: bibcite_fn_article_references |
|
||||||
label: 'Works Cited' |
|
||||||
description: 'List of works mentioned in this article.' |
|
||||||
required: false |
|
||||||
translatable: true |
|
||||||
default_value: { } |
|
||||||
default_value_callback: '' |
|
||||||
settings: |
|
||||||
handler: 'default:bibcite_reference' |
|
||||||
handler_settings: |
|
||||||
target_bundles: |
|
||||||
artwork: artwork |
|
||||||
audiovisual: audiovisual |
|
||||||
bill: bill |
|
||||||
book: book |
|
||||||
book_chapter: book_chapter |
|
||||||
broadcast: broadcast |
|
||||||
case: case |
|
||||||
chart: chart |
|
||||||
classical: classical |
|
||||||
conference_paper: conference_paper |
|
||||||
conference_proceedings: conference_proceedings |
|
||||||
database: database |
|
||||||
film: film |
|
||||||
government_report: government_report |
|
||||||
hearing: hearing |
|
||||||
journal: journal |
|
||||||
journal_article: journal_article |
|
||||||
legal_ruling: legal_ruling |
|
||||||
magazine_article: magazine_article |
|
||||||
manuscript: manuscript |
|
||||||
map: map |
|
||||||
miscellaneous: miscellaneous |
|
||||||
miscellaneous_section: miscellaneous_section |
|
||||||
newspaper_article: newspaper_article |
|
||||||
patent: patent |
|
||||||
personal: personal |
|
||||||
presentation: presentation |
|
||||||
report: report |
|
||||||
software: software |
|
||||||
statute: statute |
|
||||||
thesis: thesis |
|
||||||
unpublished: unpublished |
|
||||||
web_article: web_article |
|
||||||
web_project_page: web_project_page |
|
||||||
web_service: web_service |
|
||||||
website: website |
|
||||||
sort: |
|
||||||
field: title |
|
||||||
direction: ASC |
|
||||||
auto_create: false |
|
||||||
auto_create_bundle: artwork |
|
||||||
field_type: entity_reference |
|
@ -1,37 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
config: |
|
||||||
- field.storage.node.field_image |
|
||||||
- node.type.bibcite_fn_article_references |
|
||||||
module: |
|
||||||
- image |
|
||||||
id: node.bibcite_fn_article_references.field_image |
|
||||||
field_name: field_image |
|
||||||
entity_type: node |
|
||||||
bundle: bibcite_fn_article_references |
|
||||||
label: Image |
|
||||||
description: '' |
|
||||||
required: false |
|
||||||
translatable: true |
|
||||||
default_value: { } |
|
||||||
default_value_callback: '' |
|
||||||
settings: |
|
||||||
file_directory: '[date:custom:Y]-[date:custom:m]' |
|
||||||
file_extensions: 'png gif jpg jpeg' |
|
||||||
max_filesize: '' |
|
||||||
max_resolution: '' |
|
||||||
min_resolution: '' |
|
||||||
alt_field: true |
|
||||||
alt_field_required: true |
|
||||||
title_field: false |
|
||||||
title_field_required: false |
|
||||||
default_image: |
|
||||||
uuid: '' |
|
||||||
alt: '' |
|
||||||
title: '' |
|
||||||
width: null |
|
||||||
height: null |
|
||||||
handler: 'default:file' |
|
||||||
handler_settings: { } |
|
||||||
field_type: image |
|
@ -1,28 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
config: |
|
||||||
- field.storage.node.field_tags |
|
||||||
- node.type.bibcite_fn_article_references |
|
||||||
- taxonomy.vocabulary.tags |
|
||||||
id: node.bibcite_fn_article_references.field_tags |
|
||||||
field_name: field_tags |
|
||||||
entity_type: node |
|
||||||
bundle: bibcite_fn_article_references |
|
||||||
label: Tags |
|
||||||
description: 'Enter a comma-separated list. For example: Amsterdam, Mexico City, "Cleveland, Ohio"' |
|
||||||
required: false |
|
||||||
translatable: true |
|
||||||
default_value: { } |
|
||||||
default_value_callback: '' |
|
||||||
settings: |
|
||||||
handler: 'default:taxonomy_term' |
|
||||||
handler_settings: |
|
||||||
target_bundles: |
|
||||||
tags: tags |
|
||||||
sort: |
|
||||||
field: name |
|
||||||
direction: asc |
|
||||||
auto_create: true |
|
||||||
auto_create_bundle: '' |
|
||||||
field_type: entity_reference |
|
@ -1,87 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
module: |
|
||||||
- bibcite_footnotes |
|
||||||
- editor |
|
||||||
- footnotes |
|
||||||
name: 'Basic HTML with References' |
|
||||||
format: basic_html_with_references |
|
||||||
weight: 0 |
|
||||||
filters: |
|
||||||
filter_reference_footnotes: |
|
||||||
id: filter_reference_footnotes |
|
||||||
provider: bibcite_footnotes |
|
||||||
status: true |
|
||||||
weight: -50 |
|
||||||
settings: |
|
||||||
footnotes_collapse: '1' |
|
||||||
footnotes_ibid: '0' |
|
||||||
notes_section_label: Notes |
|
||||||
reference_dont_show_backlink_text: '0' |
|
||||||
works_cited_sort_by: alphabetical |
|
||||||
editor_file_reference: |
|
||||||
id: editor_file_reference |
|
||||||
provider: editor |
|
||||||
status: true |
|
||||||
weight: -45 |
|
||||||
settings: { } |
|
||||||
filter_html_image_secure: |
|
||||||
id: filter_html_image_secure |
|
||||||
provider: filter |
|
||||||
status: true |
|
||||||
weight: -46 |
|
||||||
settings: { } |
|
||||||
filter_url: |
|
||||||
id: filter_url |
|
||||||
provider: filter |
|
||||||
status: false |
|
||||||
weight: -41 |
|
||||||
settings: |
|
||||||
filter_url_length: 72 |
|
||||||
filter_html: |
|
||||||
id: filter_html |
|
||||||
provider: filter |
|
||||||
status: true |
|
||||||
weight: -49 |
|
||||||
settings: |
|
||||||
allowed_html: '<a href hreflang id class="" title> <div id class=""> <em> <strong> <cite> <blockquote cite> <code> <ul type class=""> <ol id type class=""> <li id class=""> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <span id class=""> <sup> <img src alt data-entity-type data-entity-uuid data-align data-caption> <p> <fn id>' |
|
||||||
filter_html_help: true |
|
||||||
filter_html_nofollow: false |
|
||||||
filter_autop: |
|
||||||
id: filter_autop |
|
||||||
provider: filter |
|
||||||
status: false |
|
||||||
weight: -42 |
|
||||||
settings: { } |
|
||||||
filter_align: |
|
||||||
id: filter_align |
|
||||||
provider: filter |
|
||||||
status: true |
|
||||||
weight: -48 |
|
||||||
settings: { } |
|
||||||
filter_caption: |
|
||||||
id: filter_caption |
|
||||||
provider: filter |
|
||||||
status: true |
|
||||||
weight: -47 |
|
||||||
settings: { } |
|
||||||
filter_htmlcorrector: |
|
||||||
id: filter_htmlcorrector |
|
||||||
provider: filter |
|
||||||
status: false |
|
||||||
weight: -40 |
|
||||||
settings: { } |
|
||||||
filter_html_escape: |
|
||||||
id: filter_html_escape |
|
||||||
provider: filter |
|
||||||
status: false |
|
||||||
weight: -43 |
|
||||||
settings: { } |
|
||||||
filter_footnotes: |
|
||||||
id: filter_footnotes |
|
||||||
provider: footnotes |
|
||||||
status: false |
|
||||||
weight: -44 |
|
||||||
settings: |
|
||||||
footnotes_collapse: '0' |
|
@ -1,17 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
module: |
|
||||||
- menu_ui |
|
||||||
third_party_settings: |
|
||||||
menu_ui: |
|
||||||
available_menus: |
|
||||||
- main |
|
||||||
parent: 'main:' |
|
||||||
name: 'Article with References' |
|
||||||
type: bibcite_fn_article_references |
|
||||||
description: 'Article that includes a Works Cited field and in-text references.' |
|
||||||
help: '' |
|
||||||
new_revision: true |
|
||||||
preview_mode: 1 |
|
||||||
display_submitted: true |
|
@ -1,23 +0,0 @@ |
|||||||
{ |
|
||||||
"name": "roblib/bibcite_footnotes", |
|
||||||
"description": "Add citation footnotes with automatic numbering.", |
|
||||||
"type": "drupal-module", |
|
||||||
"homepage": "https://drupal.org/project/bibcite_footnotes", |
|
||||||
"authors": [ |
|
||||||
{ |
|
||||||
"name": "Alexander O'Neill (alxp)", |
|
||||||
"homepage": "https://www.drupal.org/u/alxp", |
|
||||||
"role": "Maintainer" |
|
||||||
} |
|
||||||
], |
|
||||||
"support": { |
|
||||||
"issues": "https://drupal.org/project/issues/bibcite_footnotes", |
|
||||||
"source": "https://cgit.drupalcode.org/bibcite_footnotes" |
|
||||||
}, |
|
||||||
"license": "GPL-2.0+", |
|
||||||
"minimum-stability": "dev", |
|
||||||
"require": { |
|
||||||
"drupal/core": ">=8.6", |
|
||||||
"drupal/fakeobjects": "^1.0" |
|
||||||
} |
|
||||||
} |
|
@ -1,24 +0,0 @@ |
|||||||
langcode: en |
|
||||||
status: true |
|
||||||
dependencies: |
|
||||||
module: |
|
||||||
- bibcite_entity |
|
||||||
- node |
|
||||||
third_party_settings: |
|
||||||
field_permissions: |
|
||||||
permission_type: public |
|
||||||
_core: |
|
||||||
default_config_hash: pxSiuPskUjLuu_0TFIFVYFyZtkIelIPBysbXt_LyLVk |
|
||||||
id: node.field_bibcite_fn_works_cited |
|
||||||
field_name: field_bibcite_fn_works_cited |
|
||||||
entity_type: node |
|
||||||
type: entity_reference |
|
||||||
settings: |
|
||||||
target_type: bibcite_reference |
|
||||||
module: core |
|
||||||
locked: false |
|
||||||
cardinality: -1 |
|
||||||
translatable: true |
|
||||||
indexes: { } |
|
||||||
persist_with_no_fields: false |
|
||||||
custom_storage: false |
|
@ -1,73 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
namespace Drupal\bibcite_footnotes\Plugin\BibCiteProcessor; |
|
||||||
|
|
||||||
use AcademicPuma\CiteProc\CiteProc; |
|
||||||
use Drupal\Core\Config\ConfigFactoryInterface; |
|
||||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
|
||||||
use Drupal\bibcite\Plugin\BibCiteProcessorBase; |
|
||||||
use Drupal\bibcite\Plugin\BibCiteProcessorInterface; |
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface; |
|
||||||
|
|
||||||
/** |
|
||||||
* Defines a style provider based on citeproc-php library. |
|
||||||
* |
|
||||||
* Extended to support inline citation links based on the CSL. |
|
||||||
* |
|
||||||
* @BibCiteProcessor( |
|
||||||
* id = "citeproc-php", |
|
||||||
* label = @Translation("Citeproc PHP"), |
|
||||||
* ) |
|
||||||
*/ |
|
||||||
class CiteprocPhpInline extends BibCiteProcessorBase implements BibCiteProcessorInterface, ContainerFactoryPluginInterface { |
|
||||||
|
|
||||||
/** |
|
||||||
* Config factory service. |
|
||||||
* |
|
||||||
* @var \Drupal\Core\Config\ConfigFactoryInterface |
|
||||||
*/ |
|
||||||
protected $configFactory; |
|
||||||
|
|
||||||
/** |
|
||||||
* {@inheritdoc} |
|
||||||
*/ |
|
||||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { |
|
||||||
return new static( |
|
||||||
$configuration, |
|
||||||
$plugin_id, |
|
||||||
$plugin_definition, |
|
||||||
$container->get('config.factory') |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* {@inheritdoc} |
|
||||||
*/ |
|
||||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory) { |
|
||||||
parent::__construct($configuration, $plugin_id, $plugin_definition); |
|
||||||
|
|
||||||
$this->configFactory = $config_factory; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* {@inheritdoc} |
|
||||||
*/ |
|
||||||
public function getDescription() { |
|
||||||
return $this->t('Render citation by citeproc-php library'); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* {@inheritdoc} |
|
||||||
*/ |
|
||||||
public function render($data, $csl, $lang) { |
|
||||||
$cite_proc = new CiteProc($csl, $lang); |
|
||||||
$mode = !empty($data['mode']) ? $data['mode'] : NULL; |
|
||||||
|
|
||||||
if (!$data instanceof \stdClass) { |
|
||||||
$data = json_decode(json_encode($data)); |
|
||||||
} |
|
||||||
|
|
||||||
return $cite_proc->render($data, $mode); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
Loading…
Reference in new issue