diff --git a/composer.json b/composer.json index c64e2f1..f46e73d 100644 --- a/composer.json +++ b/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": { diff --git a/config/optional b/config/optional/core.entity_form_display.taxonomy_term.licenses.default.yml similarity index 100% rename from config/optional rename to config/optional/core.entity_form_display.taxonomy_term.licenses.default.yml diff --git a/entity_embed_attribution.info.yml b/entity_embed_attribution.info.yml deleted file mode 100644 index 17c3cfb..0000000 --- a/entity_embed_attribution.info.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/entity_embed_attribution.default.licenses.yml b/media_attribution.default.licenses.yml similarity index 100% rename from entity_embed_attribution.default.licenses.yml rename to media_attribution.default.licenses.yml diff --git a/media_attribution.info.yml b/media_attribution.info.yml new file mode 100644 index 0000000..0da7357 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/entity_embed_attribution.module b/media_attribution.module similarity index 81% rename from entity_embed_attribution.module rename to media_attribution.module index 76be9a9..3e623ab 100644 --- a/entity_embed_attribution.module +++ b/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 .= '

' . t('About') . '

'; $output .= '

' . t('Attach an attribution and license info to embedded media') . '

'; @@ -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()