Browse Source

Rename module to media_attribution.

wip
Alexander O'Neill 6 years ago
parent
commit
29b3742b57
  1. 8
      composer.json
  2. 0
      config/optional/core.entity_form_display.taxonomy_term.licenses.default.yml
  3. 8
      entity_embed_attribution.info.yml
  4. 0
      media_attribution.default.licenses.yml
  5. 8
      media_attribution.info.yml
  6. 24
      media_attribution.module

8
composer.json

@ -1,14 +1,14 @@
{
"name": "drupal/entity_embed_attribution",
"name": "drupal/media_attribution",
"type": "drupal-module",
"description": "Attach an attribution and license info to embedded media",
"keywords": ["Drupal"],
"license": "GPL-2.0+",
"homepage": "https://www.drupal.org/project/entity_embed_attribution",
"homepage": "https://www.drupal.org/project/media_attribution",
"minimum-stability": "dev",
"support": {
"issues": "https://www.drupal.org/project/issues/entity_embed_attribution",
"source": "http://cgit.drupalcode.org/entity_embed_attribution"
"issues": "https://www.drupal.org/project/issues/media_attribution",
"source": "http://cgit.drupalcode.org/media_attribution"
},
"require": { },
"extra": {

0
config/optional → config/optional/core.entity_form_display.taxonomy_term.licenses.default.yml

8
entity_embed_attribution.info.yml

@ -1,8 +0,0 @@
name: 'Entity Embed Attribution'
type: module
description: 'Attach an attribution and license info to embedded media'
core: 8.x
package: 'media'
dependencies:
- media
- paragraphs

0
entity_embed_attribution.default.licenses.yml → media_attribution.default.licenses.yml

8
media_attribution.info.yml

@ -0,0 +1,8 @@
name: 'Media Attribution'
type: module
description: 'Attach attribution and license info to media entities.'
core: 8.x
package: 'media'
dependencies:
- media
- paragraphs

24
entity_embed_attribution.module → media_attribution.module

@ -2,7 +2,7 @@
/**
* @file
* Contains entity_embed_attribution.module.
* Contains media_attribution.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
@ -17,10 +17,10 @@ use Drupal\Component\Serialization\Yaml;
/**
* Implements hook_help().
*/
function entity_embed_attribution_help($route_name, RouteMatchInterface $route_match) {
function media_attribution_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the entity_embed_attribution module.
case 'help.page.entity_embed_attribution':
// Main module help for the media_attribution module.
case 'help.page.media_attribution':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Attach an attribution and license info to embedded media') . '</p>';
@ -35,7 +35,7 @@ function entity_embed_attribution_help($route_name, RouteMatchInterface $route_m
*
* Add attribution form to media embed forms and view displays.
*/
function entity_embed_attribution_modules_installed($modules) {
function media_attribution_modules_installed($modules) {
foreach (['default', 'media_browser'] as $form_variant) {
$form_entity = EntityFormDisplay::load("media.image.$form_variant");
@ -74,7 +74,7 @@ function entity_embed_attribution_modules_installed($modules) {
}
}
// Load default license terms from the module config.
entity_embed_attribution_load_default_licenses();
media_attribution_load_default_licenses();
}
/**
@ -82,7 +82,7 @@ function entity_embed_attribution_modules_installed($modules) {
*
* @param $variables
*/
function entity_embed_attribution_preprocess_entity_embed_container(&$variables) {
function media_attribution_preprocess_entity_embed_container(&$variables) {
if ($attributions = $variables['element']['#entity']->get('field_image_attribution')
->referencedEntities()) {
@ -134,18 +134,18 @@ function entity_embed_attribution_preprocess_entity_embed_container(&$variables)
/**
* Read the list of pre-defined Creative Commons licenses and create corresponding taxonomy terms.
*/
function entity_embed_attribution_load_default_licenses() {
$file_path = drupal_get_path('module', 'entity_embed_attribution') . '/entity_embed_attribution.default.licenses.yml';
function media_attribution_load_default_licenses() {
$file_path = drupal_get_path('module', 'media_attribution') . '/media_attribution.default.licenses.yml';
$file_contents = file_get_contents($file_path);
$license_data = Yaml::decode($file_contents);
foreach ($license_data as $license_item) {
entity_embed_attribution_create_license_term($license_item['title'],$license_item['short_label'], $license_item['icon_file'], $license_item['url']);
media_attribution_create_license_term($license_item['title'],$license_item['short_label'], $license_item['icon_file'], $license_item['url']);
}
}
function entity_embed_attribution_create_license_term($term_title, $term_short_label, $icon_filename, $license_url) {
$icon_file_uri = drupal_get_path('module', 'entity_embed_attribution') . "/images/$icon_filename";
function media_attribution_create_license_term($term_title, $term_short_label, $icon_filename, $license_url) {
$icon_file_uri = drupal_get_path('module', 'media_attribution') . "/images/$icon_filename";
// Just in case the file has already been created.
$icon_files = \Drupal::entityTypeManager()
Loading…
Cancel
Save