Browse Source

Refactor

wip
Alexander O'Neill 6 years ago
parent
commit
9d53fb70d3
  1. 2
      README.md
  2. 11
      config/install/core.entity_view_display.taxonomy_term.media_attribution_licenses.default.yml
  3. 1
      config/install/field.field.media.image.field_image_attribution.yml
  4. 2
      config/install/field.field.paragraph.license_attribution.field_attribution_author.yml
  5. 2
      config/install/field.field.paragraph.license_attribution.field_attribution_source.yml
  6. 4
      config/install/field.field.paragraph.license_attribution.field_license.yml
  7. 6
      config/install/field.field.taxonomy_term.media_attribution_licenses.field_license_icon.yml
  8. 6
      config/install/field.field.taxonomy_term.media_attribution_licenses.field_license_link.yml
  9. 2
      config/install/taxonomy.vocabulary.media_attribution_licenses.yml
  10. 59
      config/optional/core.entity_form_display.taxonomy_term.licenses.default.yml
  11. 2
      media_attribution.default.licenses.yml
  12. 4
      media_attribution.module

2
README.md

@ -3,7 +3,7 @@
Install as you normally would. This module creates the following entity types: Install as you normally would. This module creates the following entity types:
* Taxonomy vocabulary * Taxonomy vocabulary
* Licences (licenses) - Includes License Link and License Icon fields * Licences (media_attribution_licenses) - Includes License Link and License Icon fields
* Paragraphs type * Paragraphs type
* License Attribution (license_attribution) * License Attribution (license_attribution)

11
config/install/core.entity_view_display.taxonomy_term.licenses.default.yml → config/install/core.entity_view_display.taxonomy_term.media_attribution_licenses.default.yml

@ -2,17 +2,16 @@ langcode: en
status: true status: true
dependencies: dependencies:
config: config:
- field.field.taxonomy_term.licenses.field_license_icon - field.field.taxonomy_term.media_attribution_licenses.field_license_icon
- field.field.taxonomy_term.licenses.field_license_link - field.field.taxonomy_term.media_attribution_licenses.field_license_link
- taxonomy.vocabulary.licenses - taxonomy.vocabulary.media_attribution_licenses
module: module:
- image - image
- link - link
- text - text
third_party_settings: id: taxonomy_term.media_attribution_licenses.default
id: taxonomy_term.licenses.default
targetEntityType: taxonomy_term targetEntityType: taxonomy_term
bundle: licenses bundle: media_attribution_licenses
mode: default mode: default
content: content:
description: description:

1
config/install/field.field.media.image.field_image_attribution.yml

@ -7,7 +7,6 @@ dependencies:
- paragraphs.paragraphs_type.license_attribution - paragraphs.paragraphs_type.license_attribution
module: module:
- entity_reference_revisions - entity_reference_revisions
third_party_settings:
id: media.image.field_image_attribution id: media.image.field_image_attribution
field_name: field_image_attribution field_name: field_image_attribution
entity_type: media entity_type: media

2
config/install/field.field.paragraph.license_attribution.field_attribution_author.yml

@ -10,7 +10,7 @@ id: paragraph.license_attribution.field_attribution_author
field_name: field_attribution_author field_name: field_attribution_author
entity_type: paragraph entity_type: paragraph
bundle: license_attribution bundle: license_attribution
label: Author label: Original Author
description: 'Link to the author''s home page.' description: 'Link to the author''s home page.'
required: false required: false
translatable: false translatable: false

2
config/install/field.field.paragraph.license_attribution.field_attribution_source.yml

@ -10,7 +10,7 @@ id: paragraph.license_attribution.field_attribution_source
field_name: field_attribution_source field_name: field_attribution_source
entity_type: paragraph entity_type: paragraph
bundle: license_attribution bundle: license_attribution
label: Source label: Media Source
description: 'Link to the work''s original source. Set the link text as the title of the work.' description: 'Link to the work''s original source. Set the link text as the title of the work.'
required: false required: false
translatable: false translatable: false

4
config/install/field.field.paragraph.license_attribution.field_license.yml

@ -4,7 +4,7 @@ dependencies:
config: config:
- field.storage.paragraph.field_license - field.storage.paragraph.field_license
- paragraphs.paragraphs_type.license_attribution - paragraphs.paragraphs_type.license_attribution
- taxonomy.vocabulary.licenses - taxonomy.vocabulary.media_attribution_licenses
id: paragraph.license_attribution.field_license id: paragraph.license_attribution.field_license
field_name: field_license field_name: field_license
entity_type: paragraph entity_type: paragraph
@ -19,7 +19,7 @@ settings:
handler: 'default:taxonomy_term' handler: 'default:taxonomy_term'
handler_settings: handler_settings:
target_bundles: target_bundles:
licenses: licenses media_attribution_licenses: media_attribution_licenses
sort: sort:
field: name field: name
direction: asc direction: asc

6
config/install/field.field.taxonomy_term.licenses.field_license_icon.yml → config/install/field.field.taxonomy_term.media_attribution_licenses.field_license_icon.yml

@ -3,13 +3,13 @@ status: true
dependencies: dependencies:
config: config:
- field.storage.taxonomy_term.field_license_icon - field.storage.taxonomy_term.field_license_icon
- taxonomy.vocabulary.licenses - taxonomy.vocabulary.media_attribution_licenses
module: module:
- image - image
id: taxonomy_term.licenses.field_license_icon id: taxonomy_term.media_attribution_licenses.field_license_icon
field_name: field_license_icon field_name: field_license_icon
entity_type: taxonomy_term entity_type: taxonomy_term
bundle: licenses bundle: media_attribution_licenses
label: 'License Icon' label: 'License Icon'
description: 'Icon used to identify license rights, standardized by <a href="https://www.creativecommons.org/">Creative Commons.</a>.' description: 'Icon used to identify license rights, standardized by <a href="https://www.creativecommons.org/">Creative Commons.</a>.'
required: false required: false

6
config/install/field.field.taxonomy_term.licenses.field_license_link.yml → config/install/field.field.taxonomy_term.media_attribution_licenses.field_license_link.yml

@ -3,13 +3,13 @@ status: true
dependencies: dependencies:
config: config:
- field.storage.taxonomy_term.field_license_link - field.storage.taxonomy_term.field_license_link
- taxonomy.vocabulary.licenses - taxonomy.vocabulary.media_attribution_licenses
module: module:
- link - link
id: taxonomy_term.licenses.field_license_link id: taxonomy_term.media_attribution_licenses.field_license_link
field_name: field_license_link field_name: field_license_link
entity_type: taxonomy_term entity_type: taxonomy_term
bundle: licenses bundle: media_attribution_licenses
label: 'License link' label: 'License link'
description: '' description: ''
required: true required: true

2
config/install/taxonomy.vocabulary.licenses.yml → config/install/taxonomy.vocabulary.media_attribution_licenses.yml

@ -2,7 +2,7 @@ langcode: en
status: true status: true
dependencies: { } dependencies: { }
name: Licenses name: Licenses
vid: licenses vid: media_attribution_licenses
description: 'Licenses for content and attribution.' description: 'Licenses for content and attribution.'
hierarchy: 0 hierarchy: 0
weight: 0 weight: 0

59
config/optional/core.entity_form_display.taxonomy_term.licenses.default.yml

@ -1,59 +0,0 @@
langcode: en
status: true
dependencies:
config:
- entity_browser.browser.image_browser
- field.field.taxonomy_term.licenses.field_license_icon
- field.field.taxonomy_term.licenses.field_license_link
- taxonomy.vocabulary.licenses
module:
- entity_browser
- link
- text
_core:
default_config_hash: GeroQ_nB3tqP5g0Z5B4UShGyIomjdHA8hDn73kSFYgc
id: taxonomy_term.licenses.default
targetEntityType: taxonomy_term
bundle: licenses
mode: default
content:
description:
type: text_textarea
weight: 3
region: content
settings:
placeholder: ''
rows: 5
third_party_settings: { }
field_license_icon:
type: entity_browser_file
weight: 2
settings:
entity_browser: image_browser
field_widget_edit: true
field_widget_remove: true
view_mode: default
preview_image_style: thumbnail
open: true
field_widget_replace: false
selection_mode: selection_append
region: content
third_party_settings: { }
field_license_link:
weight: 1
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
type: link_default
region: content
name:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
hidden:
path: true

2
media_attribution.default.licenses.yml

@ -3,7 +3,7 @@
title: Attribution 4.0 International (CC BY 4.0) title: Attribution 4.0 International (CC BY 4.0)
short_label: CC BY 4.0 short_label: CC BY 4.0
icon_file: by.png icon_file: by.png
url: https://creativecommons.org/licenses/by/4.0/ url: https://creativecommons.org/icenses/by/4.0/
- -
title: Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) title: Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
short_label: CC BY-NC 4.0 short_label: CC BY-NC 4.0

4
media_attribution.module

@ -132,7 +132,7 @@ function media_attribution_preprocess_entity_embed_container(&$variables) {
} }
/** /**
* Read the list of pre-defined Creative Commons licenses and create corresponding taxonomy terms. * Read the list of pre-defined Creative Commons media_attribution_licenses and create corresponding taxonomy terms.
*/ */
function media_attribution_load_default_licenses() { function media_attribution_load_default_licenses() {
$file_path = drupal_get_path('module', 'media_attribution') . '/media_attribution.default.licenses.yml'; $file_path = drupal_get_path('module', 'media_attribution') . '/media_attribution.default.licenses.yml';
@ -162,7 +162,7 @@ function media_attribution_create_license_term($term_title, $term_short_label, $
$tid = Term::create([ $tid = Term::create([
'name' => $term_title, 'name' => $term_title,
'vid' => 'licenses', 'vid' => 'media_attribution_licenses',
'field_license_link' => ['title' => $term_short_label, 'uri' => $license_url], 'field_license_link' => ['title' => $term_short_label, 'uri' => $license_url],
'field_license_icon' => [ 'field_license_icon' => [
'target_id' => $icon_file->id(), 'target_id' => $icon_file->id(),

Loading…
Cancel
Save