attribution-1.0.x-dev/attribution.module
attribution.module
<?php
/**
* @file
* Primary module hooks for Attribution module.
*/
use Drupal\Core\Field\FieldTypeCategoryManagerInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function attribution_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.attribution':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Attach an attribution and licensing information to your site and any fieldable entity.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function attribution_theme() {
return [
'attribution_plain' => [
'variables' => [
'source' => NULL,
'author' => NULL,
'license' => NULL,
'attributes' => NULL,
],
],
'attribution_plain_oneline' => [
'variables' => [
'source' => NULL,
'author' => NULL,
'license' => NULL,
'attributes' => NULL,
],
],
'attribution_html' => [
'variables' => [
'source' => NULL,
'author' => NULL,
'license' => NULL,
'attributes' => NULL,
],
],
'attribution_creative_commons' => [
'variables' => [
'source' => NULL,
'author' => NULL,
'license' => NULL,
'attributes' => NULL,
],
],
'attribution_creative_commons_icons' => [
'variables' => [
'source' => NULL,
'author' => NULL,
'license' => NULL,
'attributes' => NULL,
],
],
'attribution_creative_commons_refined' => [
'variables' => [
'source' => NULL,
'author' => NULL,
'license' => NULL,
'attributes' => NULL,
],
],
];
}
/**
* Implements hook_field_type_category_info_alter().
*/
function attribution_field_type_category_info_alter(&$definitions) {
$definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY]['libraries'][] = 'attribution/drupal.attribution-icon';
}
